-- Hello to anyone reading this, and thank you for checking out my Blackjack Dealer AddOn!

-- DISCLAIMER:
-- This was my first attempt at creating a WoW AddOn, and so the code may look messy to more 
-- experienced developers (apologies)!
-- For any questions or queries, you're welcome to add my Battle Tag: Kingett#2160



-- Variables Initially Set
playerName = UnitName("player");
currentRealm = GetRealmName()

version = "v3.2.11"
turn = 0
gameRunning = false
tableLocked = false
tableSpectator = false

player1Active = false
player1PPSideBetWin = false
player1213SideBetWin = false
player1DoubleToggle = false
player1SplitToggle = false
player1DoubleHand1Toggle = false
player1DoubleHand2Toggle = false
player1SessionWinCalled = false
player1totalBetAmount = 0
player1totalWin = 0
player1totalLoss = 0
player1totalProfit = 0
player1TotalBankrollAmount = 0
player1NumberOfCards = 0
player1NumberOfCardsH1 = 0
player1NumberOfCardsH2 = 0
player1SessionWin = 0
player1Hotstreak = 0

player2Active = false
player2PPSideBetWin = false
player2213SideBetWin = false
player2DoubleToggle = false
player2SplitToggle = false
player2DoubleHand1Toggle = false
player2DoubleHand2Toggle = false
player2SessionWinCalled = false
player2totalBetAmount = 0
player2totalWin = 0
player2totalLoss = 0
player2totalProfit = 0
player2TotalBankrollAmount = 0
player2NumberOfCards = 0
player2NumberOfCardsH1 = 0
player2NumberOfCardsH2 = 0
player2SessionWin = 0
player2Hotstreak = 0

player3Active = false
player3PPSideBetWin = false
player3213SideBetWin = false
player3DoubleToggle = false
player3SplitToggle = false
player3DoubleHand1Toggle = false
player3DoubleHand2Toggle = false
player3SessionWinCalled = false
player3totalBetAmount = 0
player3totalWin = 0
player3totalLoss = 0
player3totalProfit = 0
player3TotalBankrollAmount = 0
player3NumberOfCards = 0
player3NumberOfCardsH1 = 0
    player3NumberOfCardsH2 = 0
player3SessionWin = 0
player3Hotstreak = 0

player4Active = false
player4PPSideBetWin = false
player4213SideBetWin = false
player4DoubleToggle = false
player4SplitToggle = false
player4DoubleHand1Toggle = false
player4DoubleHand2Toggle = false
player4SessionWinCalled = false
player4totalBetAmount = 0
player4totalWin = 0
player4totalLoss = 0
player4totalProfit = 0
player4TotalBankrollAmount = 0
player4NumberOfCards = 0
player4NumberOfCardsH1 = 0
player4NumberOfCardsH2 = 0
player4SessionWin = 0
player4Hotstreak = 0

player5Active = false
player5PPSideBetWin = false
player5213SideBetWin = false
player5DoubleToggle = false
player5SplitToggle = false
player5DoubleHand1Toggle = false
player5DoubleHand2Toggle = false
player5SessionWinCalled = false
player5totalBetAmount = 0
player5totalWin = 0
player5totalLoss = 0
player5totalProfit = 0
player5TotalBankrollAmount = 0
player5NumberOfCards = 0
player5NumberOfCardsH1 = 0
player5NumberOfCardsH2 = 0
player5SessionWin = 0
player5Hotstreak = 0

countdownDuration = 30

fadeDuration = 6
fadeIntervals = 4
fadeIntervalDuration = fadeDuration / fadeIntervals

local mixedPairPayoutValue = 5
local mixedPairPayoutReturn = mixedPairPayoutValue + 1
local colouredPairPayoutValue = 10
local colouredPairPayoutReturn = colouredPairPayoutValue + 1
local perfectPairPayoutValue = 25
local perfectPairPayoutReturn = perfectPairPayoutValue + 1
local flushPayoutValue = 5
local flushPayoutReturn = flushPayoutValue + 1
local straightPayoutValue = 10
local straightPayoutReturn = straightPayoutValue + 1
local threeOfAKindPayoutValue = 25
local threeOfAKindPayoutReturn = threeOfAKindPayoutValue + 1
local straightFlushPayoutValue = 40
local straightFlushPayoutReturn = straightFlushPayoutValue + 1
local suitedThreeOfAKindPayoutValue = 100
local suitedThreeOfAKindPayoutReturn = suitedThreeOfAKindPayoutValue + 1

minBetMain = 1
maxBetMain = 10
minBetPP = 1
maxBetPP = 3
minBet213 = 1
maxBet213 = 3

drawnCards = {}
dealtCards = {}
playerBankingInfo = {}
seatFrameFadeInfo = {}
seatFadeInfo = {
    mode = "OUT",
    timeToFade = 6,
    finishedFunc = function() seatFrame:Hide() end
}

soundFiles = {
    "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
    "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21",
    "1 or 11", "2 or 12", "3 or 13", "4 or 14", "5 or 15", "6 or 16", -- 22, 23, 24, 25, 26, 27
    "7 or 17", "8 or 18", "9 or 19", "10 or 20", -- 28, 29, 30, 31

    "DealingCard", "ConfirmBet", -- 32, 33
    "Hit", "Stand", "Double", "Split", -- 34, 35, 36, 37

    "Player1Blackjack", "Player1Win", "Player1Push", "Player1Loss", "Player1Bust", -- 38, 39, 40, 41, 42
    "Player1SplitWinWin", "Player1SplitWinPush", "Player1SplitWinLoss", -- 43, 44, 45
    "Player1SplitPushWin", "Player1SplitPushPush", "Player1SplitPushLoss", -- 46, 47, 48
    "Player1SplitLossWin", "Player1SplitLossPush", "Player1SplitLossLoss", -- 49, 50, 51

    "Player2Blackjack", "Player2Win", "Player2Push", "Player2Loss", "Player2Bust", -- 52, 53, 54, 55, 56
    "Player2SplitWinWin", "Player2SplitWinPush", "Player2SplitWinLoss", -- 57, 58, 59
    "Player2SplitPushWin", "Player2SplitPushPush", "Player2SplitPushLoss", -- 60, 61, 62
    "Player2SplitLossWin", "Player2SplitLossPush", "Player2SplitLossLoss", -- 63, 64, 65
    
    "Player3Blackjack", "Player3Win", "Player3Push", "Player3Loss", "Player3Bust", -- 66, 67, 68, 69, 70
    "Player3SplitWinWin", "Player3SplitWinPush", "Player3SplitWinLoss", -- 71, 72, 73
    "Player3SplitPushWin", "Player3SplitPushPush", "Player3SplitPushLoss", -- 74, 75, 76
    "Player3SplitLossWin", "Player3SplitLossPush", "Player3SplitLossLoss", -- 77, 78, 79

    "Player4Blackjack", "Player4Win", "Player4Push", "Player4Loss", "Player4Bust", -- 80, 81, 82, 83, 84
    "Player4SplitWinWin", "Player4SplitWinPush", "Player4SplitWinLoss", -- 85, 86, 87
    "Player4SplitPushWin", "Player4SplitPushPush", "Player4SplitPushLoss", -- 88, 89, 90
    "Player4SplitLossWin", "Player4SplitLossPush", "Player4SplitLossLoss", -- 91, 92, 93

    "Player5Blackjack", "Player5Win", "Player5Push", "Player5Loss", "Player5Bust", -- 94, 95, 96, 97, 98
    "Player5SplitWinWin", "Player5SplitWinPush", "Player5SplitWinLoss", -- 99, 100, 101
    "Player5SplitPushWin", "Player5SplitPushPush", "Player5SplitPushLoss", -- 102, 103, 104
    "Player5SplitLossWin", "Player5SplitLossPush", "Player5SplitLossLoss", -- 105, 106, 107

    "AllPlayersWin", "AllPlayersPush", "AllPlayersLoss", -- 108, 109, 110

    "DealerBlackjack", "DealerBust", -- 111, 112

    "Female_ComeBackAnytime", "Female_PaymentPlan", "Female_PleasureDoingBusiness", -- 113, 114, 115
    "Male_AhPotentialCustomer", "Male_HaveAGoodOne", "Male_TimeIsMoney" -- 116, 117, 118

}

local soundFilePaths = {}

for i, fileName in ipairs(soundFiles) do
    soundFilePaths[i] = "Interface\\AddOns\\BlackjackPlayerSOD\\Sounds\\" .. fileName .. ".mp3"
end


local cardNames = {
    ["AD.tga"] = "Ace of Diamonds",
    ["2D.tga"] = "2 of Diamonds",
    ["3D.tga"] = "3 of Diamonds",
    ["4D.tga"] = "4 of Diamonds",
    ["5D.tga"] = "5 of Diamonds",
    ["6D.tga"] = "6 of Diamonds",
    ["7D.tga"] = "7 of Diamonds",
    ["8D.tga"] = "8 of Diamonds",
    ["9D.tga"] = "9 of Diamonds",
    ["10D.tga"] = "10 of Diamonds",
    ["JD.tga"] = "Jack of Diamonds",
    ["QD.tga"] = "Queen of Diamonds",
    ["KD.tga"] = "King of Diamonds",
    ["AH.tga"] = "Ace of Hearts",
    ["2H.tga"] = "2 of Hearts",
    ["3H.tga"] = "3 of Hearts",
    ["4H.tga"] = "4 of Hearts",
    ["5H.tga"] = "5 of Hearts",
    ["6H.tga"] = "6 of Hearts",
    ["7H.tga"] = "7 of Hearts",
    ["8H.tga"] = "8 of Hearts",
    ["9H.tga"] = "9 of Hearts",
    ["10H.tga"] = "10 of Hearts",
    ["JH.tga"] = "Jack of Hearts",
    ["QH.tga"] = "Queen of Hearts",
    ["KH.tga"] = "King of Hearts",
    ["AC.tga"] = "Ace of Clubs",
    ["2C.tga"] = "2 of Clubs",
    ["3C.tga"] = "3 of Clubs",
    ["4C.tga"] = "4 of Clubs",
    ["5C.tga"] = "5 of Clubs",
    ["6C.tga"] = "6 of Clubs",
    ["7C.tga"] = "7 of Clubs",
    ["8C.tga"] = "8 of Clubs",
    ["9C.tga"] = "9 of Clubs",
    ["10C.tga"] = "10 of Clubs",
    ["JC.tga"] = "Jack of Clubs",
    ["QC.tga"] = "Queen of Clubs",
    ["KC.tga"] = "King of Clubs",
    ["AS.tga"] = "Ace of Spades",
    ["2S.tga"] = "2 of Spades",
    ["3S.tga"] = "3 of Spades",
    ["4S.tga"] = "4 of Spades",
    ["5S.tga"] = "5 of Spades",
    ["6S.tga"] = "6 of Spades",
    ["7S.tga"] = "7 of Spades",
    ["8S.tga"] = "8 of Spades",
    ["9S.tga"] = "9 of Spades",
    ["10S.tga"] = "10 of Spades",
    ["JS.tga"] = "Jack of Spades",
    ["QS.tga"] = "Queen of Spades",
    ["KS.tga"] = "King of Spades",
    -- Add more card entries as needed
}

local cardValues = {
    ["AD.tga"] = {1, 11},
    ["2D.tga"] = {2},
    ["3D.tga"] = {3},
    ["4D.tga"] = {4},
    ["5D.tga"] = {5},
    ["6D.tga"] = {6},
    ["7D.tga"] = {7},
    ["8D.tga"] = {8},
    ["9D.tga"] = {9},
    ["10D.tga"] = {10},
    ["JD.tga"] = {10},
    ["QD.tga"] = {10},
    ["KD.tga"] = {10},
    ["AH.tga"] = {1, 11},
    ["2H.tga"] = {2},
    ["3H.tga"] = {3},
    ["4H.tga"] = {4},
    ["5H.tga"] = {5},
    ["6H.tga"] = {6},
    ["7H.tga"] = {7},
    ["8H.tga"] = {8},
    ["9H.tga"] = {9},
    ["10H.tga"] = {10},
    ["JH.tga"] = {10},
    ["QH.tga"] = {10},
    ["KH.tga"] = {10},
    ["AC.tga"] = {1, 11},
    ["2C.tga"] = {2},
    ["3C.tga"] = {3},
    ["4C.tga"] = {4},
    ["5C.tga"] = {5},
    ["6C.tga"] = {6},
    ["7C.tga"] = {7},
    ["8C.tga"] = {8},
    ["9C.tga"] = {9},
    ["10C.tga"] = {10},
    ["JC.tga"] = {10},
    ["QC.tga"] = {10},
    ["KC.tga"] = {10},
    ["AS.tga"] = {1, 11},
    ["2S.tga"] = {2},
    ["3S.tga"] = {3},
    ["4S.tga"] = {4},
    ["5S.tga"] = {5},
    ["6S.tga"] = {6},
    ["7S.tga"] = {7},
    ["8S.tga"] = {8},
    ["9S.tga"] = {9},
    ["10S.tga"] = {10},
    ["JS.tga"] = {10},
    ["QS.tga"] = {10},
    ["KS.tga"] = {10},
}



























-- >> PLAYERFRAME <<
-- >> PLAYERFRAME <<
-- >> PLAYERFRAME <<

-- Creating the main playerFrame
playerFrame = CreateFrame("Frame", "BlackjackPlayerFrame", UIParent, "BasicFrameTemplateWithInset")
playerFrame:SetSize(1280, 720)
playerFrame:SetPoint("CENTER")
playerFrame:SetFrameStrata("HIGH")
playerFrame:SetFrameLevel(1)
playerFrame:Hide()

-- Setting a title
playerFrame.title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.title:SetPoint("TOP", playerFrame, 0, -5)
playerFrame.title:SetText("Blackjack Player Client v3.2.11 - Developed by Hyrav")

-- Setting background texture (Blackjack Table)
backgroundImage = playerFrame:CreateTexture(nil, "BACKGROUND")
backgroundImage:SetSize(2048, 1024)
backgroundImage:SetPoint("TOP", playerFrame, "TOP", 17, 187)
backgroundImage:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\blackjackplayerupdated.tga")
backgroundImage:SetBlendMode("BLEND")
backgroundImage:SetDrawLayer("ARTWORK")

-- "Menu" button which presents other buttons
playerFrame.menuButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.menuButton:SetPoint("TOPRIGHT", playerFrame, -23, -40)
playerFrame.menuButton:SetSize(80, 30)
playerFrame.menuButton:SetText("Menu")

-- "Report Dealer" button which links to the Discord
playerFrame.reportButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.reportButton:SetPoint("TOP", playerFrame, 205, -40)
playerFrame.reportButton:SetSize(130, 30)
playerFrame.reportButton:SetText("Report Dealer")
playerFrame.reportButton:Disable()

playerFrame.reportButton:SetScript("OnClick", function()
    StaticPopupDialogs["DISCORD_LINK"] = {
        text = "Copy the link below to join our Discord and file a report against the Dealer:",
        button1 = "Close",
        hasEditBox = true,
        hasWideEditBox = true,
        editBoxWidth = 260,
        timeout = 0,
        whileDead = true,
        hideOnEscape = true,
        preferredIndex = STATICPOPUP_NUMDIALOGS,
    }

    local dialog = StaticPopup_Show("DISCORD_LINK")
    dialog.editBox:SetText("hhttps://discord.gg/cgEPW3XnyB")
    dialog.editBox:SetFocus()
    dialog.editBox:HighlightText()
end)

-- "Tip Dealer" button which links to the Discord
playerFrame.tipButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.tipButton:SetPoint("TOP", playerFrame, 230, -73)
playerFrame.tipButton:SetSize(80, 30)
playerFrame.tipButton:SetText("Tip Dealer")
playerFrame.tipButton:Disable()

-- Tip Dealer Amount
tipDealerEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
tipDealerEditBox:SetSize(40, 30)
tipDealerEditBox:SetPoint("TOP", playerFrame, 166, -73)
tipDealerEditBox:SetAutoFocus(false)
tipDealerEditBox:SetNumeric(true)
tipDealerEditBox:Disable()

-- Function to handle the "Tip Dealer" button
function tipDealerButtonClick()
    playerTip = tonumber(tipDealerEditBox:GetText())
    if playerName == unitName1 then
        player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))
        if playerTip >= 1 and player1currentBankroll - playerTip < 0 then
            print("You do not have enough gold in your bankroll to leave that tip. Please visit the Cash Desk.")
        else
            SendChatMessage("[P1] {star} I have tipped the Dealer " .. playerTip .. "G.", "RAID")
            tipDealerEditBox:SetText("")
            tipDealerEditBox:ClearFocus()
            tipDealerEditBox:SetFocus(false)
            PlaySoundFile(soundFilePaths[33])

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(playerTip)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    elseif playerName == unitName2 then
        player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))
        if playerTip >= 1 and player2currentBankroll - playerTip < 0 then
            print("You do not have enough gold in your bankroll to leave that tip. Please visit the Cash Desk.")
        else
            SendChatMessage("[P2] {star} I have tipped the Dealer " .. playerTip .. "G.", "RAID")
            tipDealerEditBox:SetText("")
            tipDealerEditBox:ClearFocus()
            tipDealerEditBox:SetFocus(false)
            PlaySoundFile(soundFilePaths[33])

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(playerTip)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    elseif playerName == unitName3 then
        player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))
        if playerTip >= 1 and player3currentBankroll - playerTip < 0 then
            print("You do not have enough gold in your bankroll to leave that tip. Please visit the Cash Desk.")
        else
            SendChatMessage("[P3] {star} I have tipped the Dealer " .. playerTip .. "G.", "RAID")
            tipDealerEditBox:SetText("")
            tipDealerEditBox:ClearFocus()
            tipDealerEditBox:SetFocus(false)
            PlaySoundFile(soundFilePaths[33])

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(playerTip)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    elseif playerName == unitName4 then
        player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))
        if playerTip >= 1 and player4currentBankroll - playerTip < 0 then
            print("You do not have enough gold in your bankroll to leave that tip. Please visit the Cash Desk.")
        else
            SendChatMessage("[P4] {star} I have tipped the Dealer " .. playerTip .. "G.", "RAID")
            tipDealerEditBox:SetText("")
            tipDealerEditBox:ClearFocus()
            tipDealerEditBox:SetFocus(false)
            PlaySoundFile(soundFilePaths[33])

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(playerTip)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    elseif playerName == unitName5 then
        player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))
        if playerTip >= 1 and player5currentBankroll - playerTip < 0 then
            print("You do not have enough gold in your bankroll to leave that tip. Please visit the Cash Desk.")
        else
            SendChatMessage("[P5] {star} I have tipped the Dealer " .. playerTip .. "G.", "RAID")
            tipDealerEditBox:SetText("")
            tipDealerEditBox:ClearFocus()
            tipDealerEditBox:SetFocus(false)
            PlaySoundFile(soundFilePaths[33])

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(playerTip)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    end
end

-- "Tip Dealer" button
playerFrame.tipButton:SetScript("OnClick", tipDealerButtonClick)

-- "Become a Dealer" button which links to the website
playerFrame.becomeADealerButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.becomeADealerButton:SetPoint("TOP", playerFrame, -205, -73)
playerFrame.becomeADealerButton:SetSize(134, 30)
playerFrame.becomeADealerButton:SetText("Become a Dealer")

-- "Discord" button which links to the Discord
playerFrame.discordButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.discordButton:SetPoint("TOP", playerFrame, -205, -40)
playerFrame.discordButton:SetSize(134, 30)
playerFrame.discordButton:SetText("Join Discord")

playerFrame.discordButton:SetScript("OnClick", function()
    StaticPopupDialogs["DISCORD_LINK"] = {
        text = "Copy the link below to join our Discord:",
        button1 = "Close",
        hasEditBox = true,
        hasWideEditBox = true,
        editBoxWidth = 260,
        timeout = 0,
        whileDead = true,
        hideOnEscape = true,
        preferredIndex = STATICPOPUP_NUMDIALOGS,
    }

    local dialog = StaticPopup_Show("DISCORD_LINK")
    dialog.editBox:SetText("https://discord.gg/mpzpBwpY2w")
    dialog.editBox:SetFocus()
    dialog.editBox:HighlightText()
end)

playerFrame.becomeADealerButton:SetScript("OnClick", function()
    StaticPopupDialogs["WEBSITE_LINK"] = {
        text = "Copy the link below to visit our website:",
        button1 = "Close",
        hasEditBox = true,
        hasWideEditBox = true,
        editBoxWidth = 260,
        timeout = 0,
        whileDead = true,
        hideOnEscape = true,
        preferredIndex = STATICPOPUP_NUMDIALOGS,
    }

    local dialog = StaticPopup_Show("WEBSITE_LINK")
    dialog.editBox:SetText("https://wowblackjack.com")
    dialog.editBox:SetFocus()
    dialog.editBox:HighlightText()
end)

-- "History" button which shows Profit/Loss in real-time
playerFrame.historyButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.historyButton:SetPoint("TOPRIGHT", playerFrame, -23, -123)
playerFrame.historyButton:SetSize(80, 30)
playerFrame.historyButton:SetText("History")
playerFrame.historyButton:Disable()
playerFrame.historyButton:Hide()

-- "Cash Desk" button which displays the Cash Desk screen
playerFrame.cashDeskButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.cashDeskButton:SetPoint("BOTTOMLEFT", playerFrame, 17, 200)
playerFrame.cashDeskButton:SetSize(85, 30)
playerFrame.cashDeskButton:SetText("Cash Desk")
playerFrame.cashDeskButton:Disable()

-- "Take Seat" button to sit down at Seat 1
playerFrame.takeSeat1Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.takeSeat1Button:SetPoint("CENTER", playerFrame, 450, -70)
playerFrame.takeSeat1Button:SetSize(85, 30)
playerFrame.takeSeat1Button:SetText("Take Seat")

-- "Leave Seat" button to exit Seat 1
playerFrame.leaveSeat1Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.leaveSeat1Button:SetPoint("CENTER", playerFrame, 556, -85)
playerFrame.leaveSeat1Button:SetSize(75, 30)
playerFrame.leaveSeat1Button:SetText("Exit Seat")
playerFrame.leaveSeat1Button:Hide()

-- "Take Seat" button to sit down at Seat 2
playerFrame.takeSeat2Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.takeSeat2Button:SetPoint("CENTER", playerFrame, 254, -218)
playerFrame.takeSeat2Button:SetSize(85, 30)
playerFrame.takeSeat2Button:SetText("Take Seat")

-- "Leave Seat" button to exit Seat 2
playerFrame.leaveSeat2Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.leaveSeat2Button:SetPoint("CENTER", playerFrame, 360, -233)
playerFrame.leaveSeat2Button:SetSize(75, 30)
playerFrame.leaveSeat2Button:SetText("Exit Seat")
playerFrame.leaveSeat2Button:Hide()

-- "Take Seat" button to sit down at Seat 3
playerFrame.takeSeat3Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.takeSeat3Button:SetPoint("CENTER", playerFrame, 0, -265)
playerFrame.takeSeat3Button:SetSize(85, 30)
playerFrame.takeSeat3Button:SetText("Take Seat")

-- "Leave Seat" button to exit Seat 3
playerFrame.leaveSeat3Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.leaveSeat3Button:SetPoint("CENTER", playerFrame, 106, -280)
playerFrame.leaveSeat3Button:SetSize(75, 30)
playerFrame.leaveSeat3Button:SetText("Exit Seat")
playerFrame.leaveSeat3Button:Hide()

-- "Take Seat" button to sit down at Seat 4
playerFrame.takeSeat4Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.takeSeat4Button:SetPoint("CENTER", playerFrame, -256, -210)
playerFrame.takeSeat4Button:SetSize(85, 30)
playerFrame.takeSeat4Button:SetText("Take Seat")

-- "Leave Seat" button to exit Seat 4
playerFrame.leaveSeat4Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.leaveSeat4Button:SetPoint("CENTER", playerFrame, -150, -225)
playerFrame.leaveSeat4Button:SetSize(75, 30)
playerFrame.leaveSeat4Button:SetText("Exit Seat")
playerFrame.leaveSeat4Button:Hide()

-- "Take Seat" button to sit down at Seat 5
playerFrame.takeSeat5Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.takeSeat5Button:SetPoint("CENTER", playerFrame, -440, -70)
playerFrame.takeSeat5Button:SetSize(85, 30)
playerFrame.takeSeat5Button:SetText("Take Seat")

-- "Leave Seat" button to exit Seat 5
playerFrame.leaveSeat5Button = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.leaveSeat5Button:SetPoint("CENTER", playerFrame, -334, -85)
playerFrame.leaveSeat5Button:SetSize(75, 30)
playerFrame.leaveSeat5Button:SetText("Exit Seat")
playerFrame.leaveSeat5Button:Hide()

-- "Leave Table" button
playerFrame.leaveTableButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.leaveTableButton:SetPoint("TOPLEFT", playerFrame, 23, -40)
playerFrame.leaveTableButton:SetSize(85, 30)
playerFrame.leaveTableButton:SetText("Leave Table")
playerFrame.leaveTableButton:SetNormalFontObject("GameFontWhiteSmall")
playerFrame.leaveTableButton:SetHighlightFontObject("GameFontWhiteSmall")

-- Dealer Card Total Text
playerFrame.dealerCardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.dealerCardTotalText:SetPoint("TOP", playerFrame, "TOP", -65, -148)
playerFrame.dealerCardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 28, "OUTLINE") -- Adjust the font and size as needed
playerFrame.dealerCardTotalText:SetText("")

-- Enabling click-and-drag functionality
playerFrame:SetMovable(true)
playerFrame:EnableMouse(true)
playerFrame:RegisterForDrag("LeftButton")

-- Script for handling the drag of playerFrame
playerFrame:SetScript("OnDragStart", function(self)
    self:StartMoving()
end)

playerFrame:SetScript("OnDragStop", function(self)
    self:StopMovingOrSizing()
end)

-- Resets dealerFrame to the center of the screen upon reload/login
local function ResetFramePosition()
    playerFrame:ClearAllPoints()
    playerFrame:SetPoint("CENTER", 0, 0)
end

local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN")
frame:SetScript("OnEvent", ResetFramePosition)

-- Bankroll frame in the bottom-left of playerFrame
bankrollFrame = CreateFrame("Frame", "BlackjackBankrollFrame", playerFrame, "GlowBorderTemplate")
bankrollFrame:SetSize(240, 40)
bankrollFrame:SetPoint("BOTTOMLEFT", playerFrame, 18, 18)
bankrollFrame:SetFrameStrata("HIGH")
bankrollFrame:SetFrameLevel(2)

bankrollFrame.player1TotalBankrollTableDisplay = bankrollFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
bankrollFrame.player1TotalBankrollTableDisplay:SetPoint("LEFT", bankrollFrame, 9, 0)
bankrollFrame.player1TotalBankrollTableDisplay:SetJustifyH("LEFT")
bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: 0 G")
bankrollFrame.player1TotalBankrollTableDisplay:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
bankrollFrame.player1TotalBankrollTableDisplay:Hide()

bankrollFrame.player2TotalBankrollTableDisplay = bankrollFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
bankrollFrame.player2TotalBankrollTableDisplay:SetPoint("LEFT", bankrollFrame, 9, 0)
bankrollFrame.player2TotalBankrollTableDisplay:SetJustifyH("LEFT")
bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: 0 G")
bankrollFrame.player2TotalBankrollTableDisplay:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
bankrollFrame.player2TotalBankrollTableDisplay:Hide()

bankrollFrame.player3TotalBankrollTableDisplay = bankrollFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
bankrollFrame.player3TotalBankrollTableDisplay:SetPoint("LEFT", bankrollFrame, 9, 0)
bankrollFrame.player3TotalBankrollTableDisplay:SetJustifyH("LEFT")
bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: 0 G")
bankrollFrame.player3TotalBankrollTableDisplay:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
bankrollFrame.player3TotalBankrollTableDisplay:Hide()

bankrollFrame.player4TotalBankrollTableDisplay = bankrollFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
bankrollFrame.player4TotalBankrollTableDisplay:SetPoint("LEFT", bankrollFrame, 9, 0)
bankrollFrame.player4TotalBankrollTableDisplay:SetJustifyH("LEFT")
bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: 0 G")
bankrollFrame.player4TotalBankrollTableDisplay:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
bankrollFrame.player4TotalBankrollTableDisplay:Hide()

bankrollFrame.player5TotalBankrollTableDisplay = bankrollFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
bankrollFrame.player5TotalBankrollTableDisplay:SetPoint("LEFT", bankrollFrame, 9, 0)
bankrollFrame.player5TotalBankrollTableDisplay:SetJustifyH("LEFT")
bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: 0 G")
bankrollFrame.player5TotalBankrollTableDisplay:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
bankrollFrame.player5TotalBankrollTableDisplay:Hide()

bankrollFrame.BaseTextDisplay = bankrollFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
bankrollFrame.BaseTextDisplay:SetPoint("LEFT", bankrollFrame, 18, 1)
bankrollFrame.BaseTextDisplay:SetJustifyH("LEFT")
bankrollFrame.BaseTextDisplay:SetText("Sit down to deposit/withdraw")
bankrollFrame.BaseTextDisplay:SetFont("Fonts\\FRIZQT__.TTF", 13, "OUTLINE")
bankrollFrame.BaseTextDisplay:Show()

function FadeOut(frame)
    frame.fadeInfo = { mode = "OUT", timeToFade = fadeDuration, finishedFunc = function() end }
    UIFrameFade(frame, frame.fadeInfo)
end

function UpdateWinningsDisplay(frame, amount)
    frame:SetText("+" .. amount .. " G")
    frame:Show()

    FadeOut(frame)
end









-- MenuFrame in the top-right of the table UI
menuFrame = CreateFrame("Frame", "BlackjackMenuFrame", playerFrame, "InsetFrameTemplate")
menuFrame:SetSize(97, 255)
menuFrame:SetPoint("TOPRIGHT", playerFrame, -15, -88)
menuFrame:SetFrameStrata("HIGH")
menuFrame:SetFrameLevel(15)
menuFrame:Hide()

-- "Rules" button which displays the rules of Blackjack
menuFrame.rulesButton = CreateFrame("Button", nil, menuFrame, "GameMenuButtonTemplate")
menuFrame.rulesButton:SetPoint("TOP", menuFrame, 0, -7)
menuFrame.rulesButton:SetSize(80, 30)
menuFrame.rulesButton:SetText("Rules")
menuFrame.rulesButton:Disable()

-- "Payouts" button which shows side-bet combinations
menuFrame.payoutsButton = CreateFrame("Button", nil, menuFrame, "GameMenuButtonTemplate")
menuFrame.payoutsButton:SetPoint("TOP", menuFrame, 0, -40)
menuFrame.payoutsButton:SetSize(80, 30)
menuFrame.payoutsButton:SetText("Payouts")

-- "Preload" button which allows players to pre-load bets
menuFrame.preloadButton = CreateFrame("Button", nil, menuFrame, "GameMenuButtonTemplate")
menuFrame.preloadButton:SetPoint("TOP", menuFrame, 0, -73)
menuFrame.preloadButton:SetSize(80, 30)
menuFrame.preloadButton:SetText("Preload")
menuFrame.preloadButton:Disable()

-- "Cards" button which shows an enlarged image of dealt cards
menuFrame.cardsButton = CreateFrame("Button", nil, menuFrame, "GameMenuButtonTemplate")
menuFrame.cardsButton:SetPoint("TOP", menuFrame, 0, -106)
menuFrame.cardsButton:SetSize(80, 30)
menuFrame.cardsButton:SetText("Cards")
menuFrame.cardsButton:Disable()

-- "Emotes" button which allows players to use custom emotes
menuFrame.emotesButton = CreateFrame("Button", nil, menuFrame, "GameMenuButtonTemplate")
menuFrame.emotesButton:SetPoint("TOP", menuFrame, 0, -139)
menuFrame.emotesButton:SetSize(80, 30)
menuFrame.emotesButton:SetText("Emotes")
menuFrame.emotesButton:Disable()

-- "Chat Log" button which displays all Blackjack related messages from chat
menuFrame.chatLogButton = CreateFrame("Button", nil, menuFrame, "GameMenuButtonTemplate")
menuFrame.chatLogButton:SetPoint("TOP", menuFrame, 0, -172)
menuFrame.chatLogButton:SetSize(80, 30)
menuFrame.chatLogButton:SetText("Chat Log")

-- Volume slider
menuFrame.volumeSlider = CreateFrame("Slider", "BlackjackVolumeSlider", menuFrame, "OptionsSliderTemplate")
menuFrame.volumeSlider:SetWidth(72)
menuFrame.volumeSlider:SetHeight(17)
menuFrame.volumeSlider:SetPoint("TOP", menuFrame, 0, -222)
menuFrame.volumeSlider:SetMinMaxValues(0, 1)
menuFrame.volumeSlider:SetValueStep(0.01)
menuFrame.volumeSlider:SetObeyStepOnDrag(true)
menuFrame.volumeSlider:SetValue(GetCVar("Sound_MasterVolume"))

menuFrame.volumeSlider.textLow = _G[menuFrame.volumeSlider:GetName().."Low"];
menuFrame.volumeSlider.textHigh = _G[menuFrame.volumeSlider:GetName().."High"];
menuFrame.volumeSlider.text = _G[menuFrame.volumeSlider:GetName().."Text"];

menuFrame.volumeSlider.textLow:SetText("0%");
menuFrame.volumeSlider.textHigh:SetText("100%");
menuFrame.volumeSlider.text:SetText("Sounds");

menuFrame.volumeSlider:SetScript("OnValueChanged", function(self, value)
    SetCVar("Sound_MasterVolume", value);
    SetCVar("Sound_SFXVolume", value);
end);














-- Creating the numberOfDecks window
numberOfDecksFrame = CreateFrame("Frame", "TableLimitsPanelFrame", playerFrame, "InsetFrameTemplate")
numberOfDecksFrame:SetSize(240, 45)
numberOfDecksFrame:SetPoint("BOTTOMLEFT", playerFrame, 18, 148)
numberOfDecksFrame:SetAlpha(0.6)
numberOfDecksFrame:SetFrameLevel(2)

numberOfDecksTitleFrame = CreateFrame("Frame", "TableLimitsPanelFrame", numberOfDecksFrame, "InsetFrameTemplate")
numberOfDecksTitleFrame:SetSize(240, 24)
numberOfDecksTitleFrame:SetPoint("TOP", numberOfDecksFrame, 0, 0)
numberOfDecksTitleFrame:SetAlpha(0.35)
numberOfDecksTitleFrame:SetFrameLevel(3)

numberOfDecksTextFrame = CreateFrame("Frame", nil, playerFrame)
numberOfDecksTextFrame:SetAllPoints(numberOfDecksFrame)
numberOfDecksTextFrame:SetAlpha(1)
numberOfDecksTextFrame:SetFrameLevel(4)

numberOfDecksTextTitle = numberOfDecksTextFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
numberOfDecksTextTitle:SetPoint("TOP", 4, -7)
numberOfDecksTextTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
numberOfDecksTextTitle:SetText("Number of Decks")

numberOfDecksInShoeText = numberOfDecksTextFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
numberOfDecksInShoeText:SetPoint("CENTER", 4, -10)
numberOfDecksInShoeText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
numberOfDecksInShoeText:SetText("6     (312 cards total)")
numberOfDecksInShoeText:SetTextColor(1, 0.992, 0.506)



















-- Creating the tableLimits window
tableLimitsFrame = CreateFrame("Frame", "TableLimitsPanelFrame", playerFrame, "InsetFrameTemplate")
tableLimitsFrame:SetSize(240, 65)
tableLimitsFrame:SetPoint("BOTTOMLEFT", playerFrame, 18, 75)
tableLimitsFrame:SetAlpha(0.6)
tableLimitsFrame:SetFrameLevel(2)

tableLimitsTitleFrame = CreateFrame("Frame", "TableLimitsPanelFrame", tableLimitsFrame, "InsetFrameTemplate")
tableLimitsTitleFrame:SetSize(240, 24)
tableLimitsTitleFrame:SetPoint("TOP", tableLimitsFrame, 0, 0)
tableLimitsTitleFrame:SetAlpha(0.35)
tableLimitsTitleFrame:SetFrameLevel(3)

tableLimitsTextFrame = CreateFrame("Frame", nil, playerFrame)
tableLimitsTextFrame:SetAllPoints(tableLimitsFrame)
tableLimitsTextFrame:SetAlpha(1)
tableLimitsTextFrame:SetFrameLevel(4)

tableLimitsTextTitle = tableLimitsTextFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
tableLimitsTextTitle:SetPoint("TOP", 4, -7)
tableLimitsTextTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
tableLimitsTextTitle:SetText("Table Limits")

tableLimitsMainTitle = tableLimitsTextFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
tableLimitsMainTitle:SetPoint("TOPLEFT", 47, -30)
tableLimitsMainTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
tableLimitsMainTitle:SetText("Main:")

tableLimitsMainText = tableLimitsTextFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
tableLimitsMainText:SetPoint("TOPLEFT", 95, -30)
tableLimitsMainText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
tableLimitsMainText:SetJustifyH("LEFT")
tableLimitsMainText:SetText("1G  -  10G")
tableLimitsMainText:SetTextColor(1, 0.992, 0.506)

tableLimitsSideTitle = tableLimitsTextFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
tableLimitsSideTitle:SetPoint("TOPLEFT", 51, -46)
tableLimitsSideTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
tableLimitsSideTitle:SetText("Side:")

tableLimitsSideText = tableLimitsTextFrame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
tableLimitsSideText:SetPoint("TOPLEFT", 95, -46)
tableLimitsSideText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
tableLimitsSideText:SetJustifyH("LEFT")
tableLimitsSideText:SetText("1G  -  3G")
tableLimitsSideText:SetTextColor(1, 0.992, 0.506)


















seatFrame = CreateFrame("Frame", "BlackjackSeatFrame", playerFrame)
seatFrame:SetSize(300, 80)
seatFrame:SetPoint("CENTER", playerFrame, 0, 100)
seatFrame:SetFrameStrata("HIGH")
seatFrame:SetFrameLevel(15)
seatFrame:Hide()

seatFrameBackground = seatFrame:CreateTexture(nil, "BACKGROUND")
seatFrameBackground:SetAllPoints(seatFrame)
seatFrameBackground:SetColorTexture(0, 0, 0, 0.70)

seatFrame.seat1 = seatFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
seatFrame.seat1:SetPoint("CENTER", seatFrame, 0, 0)
seatFrame.seat1:SetFont("Fonts\\FRIZQT__.TTF", 24, "OUTLINE")
seatFrame.seat1:SetText("You have sat in |cFFFFD64CSeat 1|r\nYou are now |cFFFFD64CPlayer 1|r")
seatFrame.seat1:SetJustifyH("CENTER")
seatFrame.seat1:Hide()

seatFrame.seat2 = seatFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
seatFrame.seat2:SetPoint("CENTER", seatFrame, 0, 0)
seatFrame.seat2:SetFont("Fonts\\FRIZQT__.TTF", 24, "OUTLINE")
seatFrame.seat2:SetText("You have sat in |cFFFFD64CSeat 2|r\nYou are now |cFFFFD64CPlayer 2|r")
seatFrame.seat2:SetJustifyH("CENTER")
seatFrame.seat2:Hide()

seatFrame.seat3 = seatFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
seatFrame.seat3:SetPoint("CENTER", seatFrame, 0, 0)
seatFrame.seat3:SetFont("Fonts\\FRIZQT__.TTF", 24, "OUTLINE")
seatFrame.seat3:SetText("You have sat in |cFFFFD64CSeat 3|r\nYou are now |cFFFFD64CPlayer 3|r")
seatFrame.seat3:SetJustifyH("CENTER")
seatFrame.seat3:Hide()

seatFrame.seat4 = seatFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
seatFrame.seat4:SetPoint("CENTER", seatFrame, 0, 0)
seatFrame.seat4:SetFont("Fonts\\FRIZQT__.TTF", 24, "OUTLINE")
seatFrame.seat4:SetText("You have sat in |cFFFFD64CSeat 4|r\nYou are now |cFFFFD64CPlayer 4|r")
seatFrame.seat4:SetJustifyH("CENTER")
seatFrame.seat4:Hide()

seatFrame.seat5 = seatFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
seatFrame.seat5:SetPoint("CENTER", seatFrame, 0, 0)
seatFrame.seat5:SetFont("Fonts\\FRIZQT__.TTF", 24, "OUTLINE")
seatFrame.seat5:SetText("You have sat in |cFFFFD64CSeat 5|r\nYou are now |cFFFFD64CPlayer 5|r")
seatFrame.seat5:SetJustifyH("CENTER")
seatFrame.seat5:Hide()

function ResetSeatFrame1()
    seatFrameFadeInfo.mode = nil
    seatFrameFadeInfo.timeToFade = nil
    seatFrameFadeInfo.finishedFunc = nil
    seatFrameFadeInfo.finishedArg1 = nil
    seatFrameFadeInfo.finishedArg2 = nil

    seatFrame:SetScript("OnUpdate", nil)
end
function StartSeat1FadeOut()
    seatFrame:Show()
    seatFrame.seat1:SetAlpha(1)
    seatFrameBackground:SetAlpha(0.7)  -- Set initial alpha for background

    local elapsedTime = 0

    seatFrame:SetScript("OnUpdate", function(_, elapsed)
        elapsedTime = elapsedTime + elapsed

        if elapsedTime >= seatFadeInfo.timeToFade then
            seatFrame:Hide()
            seatFrame:SetScript("OnUpdate", nil)
        else
            local alpha = 1 - elapsedTime / seatFadeInfo.timeToFade
            seatFrame.seat1:SetAlpha(alpha)
            seatFrameBackground:SetAlpha(0.90 * alpha)  -- Adjust background alpha
        end
    end)
end

function ResetSeatFrame2()
    seatFrameFadeInfo.mode = nil
    seatFrameFadeInfo.timeToFade = nil
    seatFrameFadeInfo.finishedFunc = nil
    seatFrameFadeInfo.finishedArg1 = nil
    seatFrameFadeInfo.finishedArg2 = nil

    seatFrame:SetScript("OnUpdate", nil)
end
function StartSeat2FadeOut()
    seatFrame:Show()
    seatFrame.seat2:SetAlpha(1)
    seatFrameBackground:SetAlpha(0.7)  -- Set initial alpha for background

    local elapsedTime = 0

    seatFrame:SetScript("OnUpdate", function(_, elapsed)
        elapsedTime = elapsedTime + elapsed

        if elapsedTime >= seatFadeInfo.timeToFade then
            seatFrame:Hide()
            seatFrame:SetScript("OnUpdate", nil)
        else
            local alpha = 1 - elapsedTime / seatFadeInfo.timeToFade
            seatFrame.seat2:SetAlpha(alpha)
            seatFrameBackground:SetAlpha(0.90 * alpha)  -- Adjust background alpha
        end
    end)
end

function ResetSeatFrame3()
    seatFrameFadeInfo.mode = nil
    seatFrameFadeInfo.timeToFade = nil
    seatFrameFadeInfo.finishedFunc = nil
    seatFrameFadeInfo.finishedArg1 = nil
    seatFrameFadeInfo.finishedArg2 = nil

    seatFrame:SetScript("OnUpdate", nil)
end
function StartSeat3FadeOut()
    seatFrame:Show()
    seatFrame.seat3:SetAlpha(1)
    seatFrameBackground:SetAlpha(0.7)  -- Set initial alpha for background

    local elapsedTime = 0

    seatFrame:SetScript("OnUpdate", function(_, elapsed)
        elapsedTime = elapsedTime + elapsed

        if elapsedTime >= seatFadeInfo.timeToFade then
            seatFrame:Hide()
            seatFrame:SetScript("OnUpdate", nil)
        else
            local alpha = 1 - elapsedTime / seatFadeInfo.timeToFade
            seatFrame.seat3:SetAlpha(alpha)
            seatFrameBackground:SetAlpha(0.90 * alpha)  -- Adjust background alpha
        end
    end)
end

function ResetSeatFrame4()
    seatFrameFadeInfo.mode = nil
    seatFrameFadeInfo.timeToFade = nil
    seatFrameFadeInfo.finishedFunc = nil
    seatFrameFadeInfo.finishedArg1 = nil
    seatFrameFadeInfo.finishedArg2 = nil

    seatFrame:SetScript("OnUpdate", nil)
end
function StartSeat4FadeOut()
    seatFrame:Show()
    seatFrame.seat4:SetAlpha(1)
    seatFrameBackground:SetAlpha(0.7)  -- Set initial alpha for background

    local elapsedTime = 0

    seatFrame:SetScript("OnUpdate", function(_, elapsed)
        elapsedTime = elapsedTime + elapsed

        if elapsedTime >= seatFadeInfo.timeToFade then
            seatFrame:Hide()
            seatFrame:SetScript("OnUpdate", nil)
        else
            local alpha = 1 - elapsedTime / seatFadeInfo.timeToFade
            seatFrame.seat4:SetAlpha(alpha)
            seatFrameBackground:SetAlpha(0.90 * alpha)  -- Adjust background alpha
        end
    end)
end

function ResetSeatFrame5()
    seatFrameFadeInfo.mode = nil
    seatFrameFadeInfo.timeToFade = nil
    seatFrameFadeInfo.finishedFunc = nil
    seatFrameFadeInfo.finishedArg1 = nil
    seatFrameFadeInfo.finishedArg2 = nil

    seatFrame:SetScript("OnUpdate", nil)
end
function StartSeat5FadeOut()
    seatFrame:Show()
    seatFrame.seat5:SetAlpha(1)
    seatFrameBackground:SetAlpha(0.7)  -- Set initial alpha for background

    local elapsedTime = 0

    seatFrame:SetScript("OnUpdate", function(_, elapsed)
        elapsedTime = elapsedTime + elapsed

        if elapsedTime >= seatFadeInfo.timeToFade then
            seatFrame:Hide()
            seatFrame:SetScript("OnUpdate", nil)
        else
            local alpha = 1 - elapsedTime / seatFadeInfo.timeToFade
            seatFrame.seat5:SetAlpha(alpha)
            seatFrameBackground:SetAlpha(0.90 * alpha)  -- Adjust background alpha
        end
    end)
end













-- >> TIMER FRAME <<
-- >> TIMER FRAME <<
-- >> TIMER FRAME <<

timerFrame = CreateFrame("Frame", "BlackjackTimerFrame", playerFrame)
timerFrame:SetSize(210, 30)
timerFrame:SetPoint("TOP", playerFrame, -246, -65)
timerFrame:SetFrameStrata("HIGH")
timerFrame:SetFrameLevel(15)
timerFrame:Hide()

timerFrameBackground = timerFrame:CreateTexture(nil, "BACKGROUND")
timerFrameBackground:SetAllPoints(timerFrame)
timerFrameBackground:SetColorTexture(0, 0, 0, 0.45)

timerBetsFrame = CreateFrame("Frame", "BlackjackTimerBetsFrame", playerFrame)
timerBetsFrame:SetSize(300, 80)
timerBetsFrame:SetPoint("CENTER", playerFrame, 0, 100)
timerBetsFrame:SetFrameStrata("HIGH")
timerBetsFrame:SetFrameLevel(15)
timerBetsFrame:Hide()

timerBetsFrameBackground = timerBetsFrame:CreateTexture(nil, "BACKGROUND")
timerBetsFrameBackground:SetAllPoints(timerBetsFrame)
timerBetsFrameBackground:SetColorTexture(0, 0, 0, 0.45)

-- Timer Limit 1
timerFrame.player1TimerText = timerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
timerFrame.player1TimerText:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
-- Timer Limit 2
timerFrame.player2TimerText = timerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
timerFrame.player2TimerText:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
-- Timer Limit 3
timerFrame.player3TimerText = timerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
timerFrame.player3TimerText:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
-- Timer Limit 4
timerFrame.player4TimerText = timerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
timerFrame.player4TimerText:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
-- Timer Limit 5
timerFrame.player5TimerText = timerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
timerFrame.player5TimerText:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
-- Timer Limit Bets
timerBetsFrame.timerTextBets = timerBetsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")
timerBetsFrame.timerTextBets:SetPoint("CENTER", timerBetsFrame, 0, 0)
timerBetsFrame.timerTextBets:SetFont("Fonts\\FRIZQT__.TTF", 24, "OUTLINE")
timerBetsFrame.timerTextBets:SetJustifyH("CENTER")

























-- >> CASH DESK <<
-- >> CASH DESK <<
-- >> CASH DESK <<

-- Creating the cashDeskFrame window
cashDeskFrame = CreateFrame("Frame", "BlackjackCashDeskFrame", UIParent, "BasicFrameTemplateWithInset")
cashDeskFrame:SetSize(1080, 607)
cashDeskFrame:SetPoint("CENTER", playerFrame, 0, 0)
cashDeskFrame:SetFrameStrata("HIGH")
cashDeskFrame:SetFrameLevel(20)
cashDeskFrame:Hide()

-- Setting a title
cashDeskFrame.title = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.title:SetPoint("TOP", cashDeskFrame, 0, -5)
cashDeskFrame.title:SetText("Blackjack Player Client v3.2.11 - Developed by Hyrav")

-- Setting background texture (Cash Desk)
cashDeskBackgroundImage = cashDeskFrame:CreateTexture(nil, "BACKGROUND")
cashDeskBackgroundImage:SetSize(1265, 603)
cashDeskBackgroundImage:SetPoint("CENTER", cashDeskFrame, -3, -11)
cashDeskBackgroundImage:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CashDeskBase.tga")
cashDeskBackgroundImage:SetBlendMode("BLEND")
cashDeskBackgroundImage:SetDrawLayer("ARTWORK")

-- Creating the Buy In button
cashDeskFrame.buyInButton = CreateFrame("Button", nil, cashDeskFrame, "GameMenuButtonTemplate")
cashDeskFrame.buyInButton:SetPoint("CENTER", cashDeskFrame, -130, -150)
cashDeskFrame.buyInButton:SetSize(150, 40)
cashDeskFrame.buyInButton:SetText("Buy-In")

-- Creating the Cash Out button
cashDeskFrame.cashOutButton = CreateFrame("Button", nil, cashDeskFrame, "GameMenuButtonTemplate")
cashDeskFrame.cashOutButton:SetPoint("CENTER", cashDeskFrame, 130, -150)
cashDeskFrame.cashOutButton:SetSize(150, 40)
cashDeskFrame.cashOutButton:SetText("Cash-Out")

-- Buy In Amount
buyInEditBox = CreateFrame("EditBox", nil, cashDeskFrame, "InputBoxTemplate")
buyInEditBox:SetSize(80, 30)
buyInEditBox:SetPoint("CENTER", cashDeskFrame, -135, -115)
buyInEditBox:SetAutoFocus(false)

cashDeskFrame.buyInAmountG = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.buyInAmountG:SetPoint("CENTER", cashDeskFrame, -81, -114)
cashDeskFrame.buyInAmountG:SetText("G")
cashDeskFrame.buyInAmountG:SetJustifyH("CENTER")
cashDeskFrame.buyInAmountG:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")

-- Cash Out Amount
cashOutEditBox = CreateFrame("EditBox", nil, cashDeskFrame, "InputBoxTemplate")
cashOutEditBox:SetSize(80, 30)
cashOutEditBox:SetPoint("CENTER", cashDeskFrame, 125, -115)
cashOutEditBox:SetAutoFocus(false)

cashDeskFrame.buyInAmountG = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.buyInAmountG:SetPoint("CENTER", cashDeskFrame, 178, -114)
cashDeskFrame.buyInAmountG:SetText("G")
cashDeskFrame.buyInAmountG:SetJustifyH("CENTER")
cashDeskFrame.buyInAmountG:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")

-- Create a "Join Table" button to start the game
cashDeskFrame.returnButton = CreateFrame("Button", nil, cashDeskFrame, "GameMenuButtonTemplate")
cashDeskFrame.returnButton:SetPoint("BOTTOMRIGHT", cashDeskFrame, -25, 45)
cashDeskFrame.returnButton:SetSize(120, 40)
cashDeskFrame.returnButton:SetText("Return")

-- Disclaimer text below leave table button
cashDeskFrame.DisclaimerText = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.DisclaimerText:SetPoint("BOTTOM", cashDeskFrame, 0, 25)
cashDeskFrame.DisclaimerText:SetJustifyH("CENTER")
cashDeskFrame.DisclaimerText:SetText("Only stake what you can afford to lose.\nWhen the fun stops - stop immediately.")
cashDeskFrame.DisclaimerText:SetTextColor(1 , 0, 0)
cashDeskFrame.DisclaimerText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")

-- Bankroll
cashDeskFrame.player1TotalBankroll = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.player1TotalBankroll:SetPoint("CENTER", cashDeskFrame, 0, -225)
cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: 0 G")
cashDeskFrame.player1TotalBankroll:SetJustifyH("CENTER")
cashDeskFrame.player1TotalBankroll:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
cashDeskFrame.player1TotalBankroll:Hide()

-- Bankroll
cashDeskFrame.player2TotalBankroll = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.player2TotalBankroll:SetPoint("CENTER", cashDeskFrame, 0, -225)
cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: 0 G")
cashDeskFrame.player2TotalBankroll:SetJustifyH("CENTER")
cashDeskFrame.player2TotalBankroll:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
cashDeskFrame.player2TotalBankroll:Hide()

-- Bankroll
cashDeskFrame.player3TotalBankroll = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.player3TotalBankroll:SetPoint("CENTER", cashDeskFrame, 0, -225)
cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: 0 G")
cashDeskFrame.player3TotalBankroll:SetJustifyH("CENTER")
cashDeskFrame.player3TotalBankroll:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
cashDeskFrame.player3TotalBankroll:Hide()

-- Bankroll
cashDeskFrame.player4TotalBankroll = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.player4TotalBankroll:SetPoint("CENTER", cashDeskFrame, 0, -225)
cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: 0 G")
cashDeskFrame.player4TotalBankroll:SetJustifyH("CENTER")
cashDeskFrame.player4TotalBankroll:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
cashDeskFrame.player4TotalBankroll:Hide()

-- Bankroll
cashDeskFrame.player5TotalBankroll = cashDeskFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
cashDeskFrame.player5TotalBankroll:SetPoint("CENTER", cashDeskFrame, 0, -225)
cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: 0 G")
cashDeskFrame.player5TotalBankroll:SetJustifyH("CENTER")
cashDeskFrame.player5TotalBankroll:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
cashDeskFrame.player5TotalBankroll:Hide()

-- Player 1 Buy-In Function
function player1BuyIn()
    player1BuyInAmount = tonumber(buyInEditBox:GetText())
    if player1BuyInAmount and player1BuyInAmount >= minBetMain then

        buyInEditBox:SetFocus(false)
        buyInEditBox:ClearFocus()
        
        local goldPart = math.floor(player1BuyInAmount)
        local silverPart = (player1BuyInAmount - goldPart) * 100

        player1BuyInAmountGoldValue = goldPart * 10000 + silverPart * 100

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)
        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                -- Set the copper amount in the trade window
                MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, player1BuyInAmountGoldValue)
                PlaySoundFile(soundFilePaths[33])
                -- Send the chat message only if the trade window is open
                SendChatMessage("{square} [P1] Buy-In for " .. player1BuyInAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
    else
        print("Please enter a value of at least 50G.")
    end

end
-- Player 1 Cash-Out Function
function player1CashOut()
    player1CashOutAmount = tonumber(cashOutEditBox:GetText()) -- Get the entered bet amount
    player1currentBankroll = tonumber(string.match(cashDeskFrame.player1TotalBankroll:GetText(), "%d+"))

    if player1CashOutAmount <= player1currentBankroll then

        cashOutEditBox:SetFocus(false)
        cashOutEditBox:ClearFocus()
        

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)

        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                PlaySoundFile(soundFilePaths[33])
                SendChatMessage("{square} [P1] Cash-Out for " .. player1CashOutAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
     
    else
        print("You don't have that much in your bankroll. Please choose a lower amount.")
    end

end
-- Player 2 Buy-In Function
function player2BuyIn()
    player2BuyInAmount = tonumber(buyInEditBox:GetText()) -- Get the entered bet amount
    if player2BuyInAmount and player2BuyInAmount >= minBetMain then
        
        buyInEditBox:SetFocus(false)
        buyInEditBox:ClearFocus()
        
        
        player2BuyInAmountGoldValue = player2BuyInAmount * 10000

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)
        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                -- Set the copper amount in the trade window
                MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, player2BuyInAmountGoldValue)
                PlaySoundFile(soundFilePaths[33])
                -- Send the chat message only if the trade window is open
                SendChatMessage("{square} [P2] Buy-In for " .. player2BuyInAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
    else
        print("Please enter a value of at least 50G.")
    end

end
-- Player 2 Cash-Out Function
function player2CashOut()
    player2CashOutAmount = tonumber(cashOutEditBox:GetText()) -- Get the entered bet amount
    player2currentBankroll = tonumber(string.match(cashDeskFrame.player2TotalBankroll:GetText(), "%d+"))

    if player2CashOutAmount <= player2currentBankroll then

        cashOutEditBox:SetFocus(false)
        cashOutEditBox:ClearFocus()
        

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)

        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                PlaySoundFile(soundFilePaths[33])
                SendChatMessage("{square} [P2] Cash-Out for " .. player2CashOutAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
     
    else
        print("You don't have that much in your bankroll. Please choose a lower amount.")
    end

end
-- Player 3 Buy-In Function
function player3BuyIn()
    player3BuyInAmount = tonumber(buyInEditBox:GetText()) -- Get the entered bet amount
    if player3BuyInAmount and player3BuyInAmount >= minBetMain then
        
        buyInEditBox:SetFocus(false)
        buyInEditBox:ClearFocus()
        PlaySoundFile(soundFilePaths[33])
        
        player3BuyInAmountGoldValue = player3BuyInAmount * 10000

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)
        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                -- Set the copper amount in the trade window
                MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, player3BuyInAmountGoldValue)
                
                -- Send the chat message only if the trade window is open
                SendChatMessage("{square} [P3] Buy-In for " .. player3BuyInAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
    else
        print("Please enter a value of at least 50G.")
    end

end
-- Player 3 Cash-Out Function
function player3CashOut()
    player3CashOutAmount = tonumber(cashOutEditBox:GetText()) -- Get the entered bet amount
    player3currentBankroll = tonumber(string.match(cashDeskFrame.player3TotalBankroll:GetText(), "%d+"))

    if player3CashOutAmount <= player3currentBankroll then

        cashOutEditBox:SetFocus(false)
        cashOutEditBox:ClearFocus()
        

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)

        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                PlaySoundFile(soundFilePaths[33])
                SendChatMessage("{square} [P3] Cash-Out for " .. player3CashOutAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
     
    else
        print("You don't have that much in your bankroll. Please choose a lower amount.")
    end

end
-- Player 4 Buy-In Function
function player4BuyIn()
    player4BuyInAmount = tonumber(buyInEditBox:GetText()) -- Get the entered bet amount
    if player4BuyInAmount and player4BuyInAmount >= minBetMain then
        
        buyInEditBox:SetFocus(false)
        buyInEditBox:ClearFocus()
        PlaySoundFile(soundFilePaths[33])
        
        player4BuyInAmountGoldValue = player4BuyInAmount * 10000

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)
        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                -- Set the copper amount in the trade window
                MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, player4BuyInAmountGoldValue)
                
                -- Send the chat message only if the trade window is open
                SendChatMessage("{square} [P4] Buy-In for " .. player4BuyInAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
    else
        print("Please enter a value of at least 50G.")
    end

end
-- Player 4 Cash-Out Function
function player4CashOut()
    player4CashOutAmount = tonumber(cashOutEditBox:GetText()) -- Get the entered bet amount
    player4currentBankroll = tonumber(string.match(cashDeskFrame.player4TotalBankroll:GetText(), "%d+"))

    if player4CashOutAmount <= player4currentBankroll then

        cashOutEditBox:SetFocus(false)
        cashOutEditBox:ClearFocus()
        

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)

        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                PlaySoundFile(soundFilePaths[33])
                SendChatMessage("{square} [P4] Cash-Out for " .. player4CashOutAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
     
    else
        print("You don't have that much in your bankroll. Please choose a lower amount.")
    end

end
-- Player 5 Buy-In Function
function player5BuyIn()
    player5BuyInAmount = tonumber(buyInEditBox:GetText()) -- Get the entered bet amount
    if player5BuyInAmount and player5BuyInAmount >= minBetMain then
        
        buyInEditBox:SetFocus(false)
        buyInEditBox:ClearFocus()
        PlaySoundFile(soundFilePaths[33])
        
        player5BuyInAmountGoldValue = player5BuyInAmount * 10000

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)
        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                -- Set the copper amount in the trade window
                MoneyInputFrame_SetCopper(TradePlayerInputMoneyFrame, player5BuyInAmountGoldValue)
                
                -- Send the chat message only if the trade window is open
                SendChatMessage("{square} [P5] Buy-In for " .. player5BuyInAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
    else
        print("Please enter a value of at least 50G.")
    end

end
-- Player 5 Cash-Out Function
function player5CashOut()
    player5CashOutAmount = tonumber(cashOutEditBox:GetText()) -- Get the entered bet amount
    player5currentBankroll = tonumber(string.match(cashDeskFrame.player5TotalBankroll:GetText(), "%d+"))

    if player5CashOutAmount <= player5currentBankroll then

        cashOutEditBox:SetFocus(false)
        cashOutEditBox:ClearFocus()
        

        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/trade", chatFrame)
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:Insert("/trade")
        ChatEdit_SendText(editBox)

        C_Timer.After(1, function()
            if TradeFrame:IsShown() then
                PlaySoundFile(soundFilePaths[33])
                SendChatMessage("{square} [P5] Cash-Out for " .. player5CashOutAmount .. "G.", "RAID")
            else
                print("Please target (click on) the Dealer, before trying again.")
            end
        end)
     
    else
        print("You don't have that much in your bankroll. Please choose a lower amount.")
    end

end

-- Buy-In Instructions Frame
stepsFrame = CreateFrame("Frame", "BlackjackStepsFrame", UIParent, "BasicFrameTemplate")
stepsFrame:SetSize(300, 250)
stepsFrame:SetPoint("LEFT", cashDeskFrame, 5, 40)
stepsFrame:SetFrameStrata("HIGH")
stepsFrame:SetFrameLevel(25)
stepsFrame:Hide()

stepsFrame.title = stepsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame.title:SetPoint("TOP", stepsFrame, 0, -5)
stepsFrame.title:SetText("Buy-In Instructions")

stepsFrame.dealerImage = stepsFrame:CreateTexture(nil, "OVERLAY")
stepsFrame.dealerImage:SetSize(256, 128)
stepsFrame.dealerImage:SetPoint("CENTER", stepsFrame, 0, 13)
if currentRealm == "Earthshaker" then
    stepsFrame.dealerImage:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\DealerTargetEarthshaker.tga")
elseif currentRealm == "Gehennas" then
    stepsFrame.dealerImage:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\DealerTargetGehennas.tga")
else
    stepsFrame.dealerImage:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\DealerTarget.tga")
end
stepsFrame.dealerImage:SetBlendMode("BLEND")
stepsFrame.dealerImage:SetDrawLayer("ARTWORK")

stepsFrame.step1Title = stepsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame.step1Title:SetPoint("CENTER", stepsFrame, 0, 83)
stepsFrame.step1Title:SetText("STEP 1")
stepsFrame.step1Title:SetJustifyH("CENTER")
stepsFrame.step1Title:SetTextColor(1, 0.298, 0.298)
stepsFrame.step1Title:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")

stepsFrame.step1Text = stepsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame.step1Text:SetPoint("CENTER", stepsFrame, 0, 67)
stepsFrame.step1Text:SetText("Target the Dealer")
stepsFrame.step1Text:SetJustifyH("CENTER")
stepsFrame.step1Text:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")

stepsFrame.step2Title = stepsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame.step2Title:SetPoint("CENTER", stepsFrame, 0, -35)
stepsFrame.step2Title:SetText("STEP 2")
stepsFrame.step2Title:SetJustifyH("CENTER")
stepsFrame.step2Title:SetTextColor(1, 0.298, 0.298)
stepsFrame.step2Title:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")

stepsFrame.step2Text = stepsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame.step2Text:SetPoint("CENTER", stepsFrame, 0, -51)
stepsFrame.step2Text:SetText("Type in an amount (1G minimum)")
stepsFrame.step2Text:SetJustifyH("CENTER")
stepsFrame.step2Text:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")

stepsFrame.step3Title = stepsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame.step3Title:SetPoint("CENTER", stepsFrame, 0, -84)
stepsFrame.step3Title:SetText("STEP 3")
stepsFrame.step3Title:SetJustifyH("CENTER")
stepsFrame.step3Title:SetTextColor(1, 0.298, 0.298)
stepsFrame.step3Title:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")

stepsFrame.step3Text = stepsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame.step3Text:SetPoint("CENTER", stepsFrame, 0, -100)
stepsFrame.step3Text:SetText("Press the 'Buy-In' button")
stepsFrame.step3Text:SetJustifyH("CENTER")
stepsFrame.step3Text:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")

-- Cash-Out Instructions Frame
stepsFrame2 = CreateFrame("Frame", "BlackjackStepsFrame", UIParent, "BasicFrameTemplate")
stepsFrame2:SetSize(300, 250)
stepsFrame2:SetPoint("RIGHT", cashDeskFrame, -5, 40)
stepsFrame2:SetFrameStrata("HIGH")
stepsFrame2:SetFrameLevel(26)
stepsFrame2:Hide()

stepsFrame2.title = stepsFrame2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame2.title:SetPoint("TOP", stepsFrame2, 0, -5)
stepsFrame2.title:SetText("Cash-Out Instructions")

stepsFrame2.dealerImage2 = stepsFrame2:CreateTexture(nil, "OVERLAY")
stepsFrame2.dealerImage2:SetSize(256, 128)
stepsFrame2.dealerImage2:SetPoint("CENTER", stepsFrame2, 0, 13)
if currentRealm == "Earthshaker" then
    stepsFrame2.dealerImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\DealerTargetEarthshaker.tga")
elseif currentRealm == "Gehennas" then
    stepsFrame2.dealerImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\DealerTargetGehennas.tga")
else
    stepsFrame2.dealerImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\DealerTarget.tga")
end
stepsFrame2.dealerImage2:SetBlendMode("BLEND")
stepsFrame2.dealerImage2:SetDrawLayer("ARTWORK")

stepsFrame2.step1Title2 = stepsFrame2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame2.step1Title2:SetPoint("CENTER", stepsFrame2, 0, 83)
stepsFrame2.step1Title2:SetText("STEP 1")
stepsFrame2.step1Title2:SetJustifyH("CENTER")
stepsFrame2.step1Title2:SetTextColor(1, 0.298, 0.298)
stepsFrame2.step1Title2:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")

stepsFrame2.step1Text2 = stepsFrame2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame2.step1Text2:SetPoint("CENTER", stepsFrame2, 0, 67)
stepsFrame2.step1Text2:SetText("Target the Dealer")
stepsFrame2.step1Text2:SetJustifyH("CENTER")
stepsFrame2.step1Text2:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")

stepsFrame2.step2Title2 = stepsFrame2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame2.step2Title2:SetPoint("CENTER", stepsFrame2, 0, -35)
stepsFrame2.step2Title2:SetText("STEP 2")
stepsFrame2.step2Title2:SetJustifyH("CENTER")
stepsFrame2.step2Title2:SetTextColor(1, 0.298, 0.298)
stepsFrame2.step2Title2:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")

stepsFrame2.step2Text2 = stepsFrame2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame2.step2Text2:SetPoint("CENTER", stepsFrame2, 0, -51)
stepsFrame2.step2Text2:SetText("Type in any amount (within your bankroll)")
stepsFrame2.step2Text2:SetJustifyH("CENTER")
stepsFrame2.step2Text2:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")

stepsFrame2.step3Title2 = stepsFrame2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame2.step3Title2:SetPoint("CENTER", stepsFrame2, 0, -84)
stepsFrame2.step3Title2:SetText("STEP 3")
stepsFrame2.step3Title2:SetJustifyH("CENTER")
stepsFrame2.step3Title2:SetTextColor(1, 0.298, 0.298)
stepsFrame2.step3Title2:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")

stepsFrame2.step3Text2 = stepsFrame2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
stepsFrame2.step3Text2:SetPoint("CENTER", stepsFrame2, 0, -100)
stepsFrame2.step3Text2:SetText("Press the 'Cash-Out' button")
stepsFrame2.step3Text2:SetJustifyH("CENTER")
stepsFrame2.step3Text2:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")

cashDeskFrame:SetScript("OnHide", function(self)
    stepsFrame:Hide()
    stepsFrame2:Hide()
end)

cashDeskFrame:SetScript("OnMouseDown", function(self, button)
    if button == "LeftButton" then
        buyInEditBox:ClearFocus()
        cashOutEditBox:ClearFocus()
    end
end)

stepsFrame:SetScript("OnMouseDown", function(self, button)
    if button == "LeftButton" then
        buyInEditBox:ClearFocus()
        cashOutEditBox:ClearFocus()
    end
end)

stepsFrame2:SetScript("OnMouseDown", function(self, button)
    if button == "LeftButton" then
        buyInEditBox:ClearFocus()
        cashOutEditBox:ClearFocus()
    end
end)
























-- >> INITIAL FRAME <<
-- >> INITIAL FRAME <<
-- >> INITIAL FRAME <<

-- Create a frame for the initial screen
initialFrame = CreateFrame("Frame", "BlackjackInitialFrame", UIParent, "BasicFrameTemplateWithInset")
initialFrame:SetSize(630, 354)
initialFrame:SetPoint("CENTER")
--initialFrame:Hide()

-- Add a title to the initial frame
initialFrame.title = initialFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
initialFrame.title:SetPoint("TOP", initialFrame, 0, -5)
initialFrame.title:SetText("Welcome to Blackjack!")

-- Create a "Join Table" button to start the game
initialFrame.joinButton = CreateFrame("Button", nil, initialFrame, "GameMenuButtonTemplate")
initialFrame.joinButton:SetPoint("TOP", initialFrame, 130, -100)
initialFrame.joinButton:SetSize(135, 30)
initialFrame.joinButton:SetText("Join Table")
initialFrame.joinButton:Disable()

-- Create a font string to display the join instructions
initialFrame.join1Text = initialFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
initialFrame.join1Text:SetPoint("TOP", initialFrame, 130, -60)
initialFrame.join1Text:SetText("You will be able to play\nonce the dealer has opened up the table")
initialFrame.join1Text:SetJustifyH("CENTER")
initialFrame.join1Text:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")

-- Create a font string to display the developer
initialFrame.join3Text = initialFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
initialFrame.join3Text:SetPoint("BOTTOM", initialFrame, 130, 30)
initialFrame.join3Text:SetText("Blackjack Player v3.2.11  |  Developed by Hyrav")
initialFrame.join3Text:SetJustifyH("CENTER")
initialFrame.join3Text:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE")
initialFrame.join3Text:SetTextColor(1, 0.5, 0)

initialFrame.goblinDealer = initialFrame:CreateTexture(nil, "OVERLAY")
initialFrame.goblinDealer:SetSize(580, 580)
initialFrame.goblinDealer:SetPoint("BOTTOMLEFT", initialFrame, -148, -118)
initialFrame.goblinDealer:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\GoblinDealer.tga")
initialFrame.goblinDealer:SetBlendMode("BLEND")
initialFrame.goblinDealer:SetDrawLayer("ARTWORK")

initialFrame.licensedDealers = initialFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
initialFrame.licensedDealers:SetPoint("CENTER", initialFrame, 130, 0)
initialFrame.licensedDealers:SetText("Licensed Dealers")
initialFrame.licensedDealers:SetJustifyH("CENTER")
initialFrame.licensedDealers:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")

initialFrame.Dealer1 = initialFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
initialFrame.Dealer1:SetPoint("CENTER", initialFrame, 130, -26)
initialFrame.Dealer1:SetText("Living Flame • Alliance • Hyrav")
initialFrame.Dealer1:SetTextColor(0.369, 0.675, 0.969)
initialFrame.Dealer1:SetJustifyH("CENTER")
initialFrame.Dealer1:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE")

initialFrame.Dealer2 = initialFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
initialFrame.Dealer2:SetPoint("CENTER", initialFrame, 130, -41)
initialFrame.Dealer2:SetText("Chaos Bolt • Alliance • Blackjack")
initialFrame.Dealer2:SetTextColor(0.369, 0.675, 0.969)
initialFrame.Dealer2:SetJustifyH("CENTER")
initialFrame.Dealer2:SetFont("Fonts\\FRIZQT__.TTF", 11, "OUTLINE")

initialFrame.joinDiscordButton = CreateFrame("Button", nil, initialFrame, "GameMenuButtonTemplate")
initialFrame.joinDiscordButton:SetPoint("CENTER", initialFrame, 130, -75)
initialFrame.joinDiscordButton:SetSize(135, 30)
initialFrame.joinDiscordButton:SetText("Join Discord")

initialFrame.joinDiscordButton:SetScript("OnClick", function()
    StaticPopupDialogs["DISCORD_LINK"] = {
        text = "Copy the link below to join our Discord:",
        button1 = "Close",
        hasEditBox = true,
        hasWideEditBox = true,
        editBoxWidth = 260,
        timeout = 0,
        whileDead = true,
        hideOnEscape = true,
        preferredIndex = STATICPOPUP_NUMDIALOGS,
    }

    local dialog = StaticPopup_Show("DISCORD_LINK")
    dialog.editBox:SetText("https://discord.gg/mpzpBwpY2w")
    dialog.editBox:SetFocus()
    dialog.editBox:HighlightText()
end)

initialFrame.dealerAddOn = CreateFrame("Button", nil, initialFrame, "GameMenuButtonTemplate")
initialFrame.dealerAddOn:SetPoint("CENTER", initialFrame, 130, -110)
initialFrame.dealerAddOn:SetSize(135, 30)
initialFrame.dealerAddOn:SetText("Become a Dealer")

initialFrame.dealerAddOn:SetScript("OnClick", function()
    StaticPopupDialogs["WEBSITE_LINK"] = {
        text = "Copy the link below to visit our website:",
        button1 = "Close",
        hasEditBox = true,
        hasWideEditBox = true,
        editBoxWidth = 260,
        timeout = 0,
        whileDead = true,
        hideOnEscape = true,
        preferredIndex = STATICPOPUP_NUMDIALOGS,
    }

    local dialog = StaticPopup_Show("WEBSITE_LINK")
    dialog.editBox:SetText("https://wowblackjack.com")
    dialog.editBox:SetFocus()
    dialog.editBox:HighlightText()
end)

-- Enable click-and-drag functionality
initialFrame:SetMovable(true)
initialFrame:EnableMouse(true)
initialFrame:RegisterForDrag("LeftButton")

-- Set the frame's script for handling the drag
initialFrame:SetScript("OnDragStart", function(self)
    self:StartMoving()
end)

initialFrame:SetScript("OnDragStop", function(self)
    self:StopMovingOrSizing()
end)

-- Function to enable the "Join Table" button
local function EnableJoinButton()
    initialFrame.joinButton:Enable()
    cashDeskFrame.returnButton:Enable()
end






























-- >> REBET WINDOW <<
-- >> REBET WINDOW <<
-- >> REBET WINDOW <<

-- Rebet window
preloadFrame = CreateFrame("Frame", "BlackjackPreloadFrame", UIParent, "InsetFrameTemplate")
preloadFrame:SetSize(170, 140)
preloadFrame:SetPoint("TOPRIGHT", playerFrame, -118, -43)
preloadFrame:SetFrameStrata("HIGH")
preloadFrame:SetFrameLevel(8)
preloadFrame:Hide()
-- Setting a title
preloadFrame.title = preloadFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
preloadFrame.title:SetPoint("TOP", preloadFrame, 0, -7)
preloadFrame.title:SetText("Preload Bets")
-- Main Bet Text
preloadFrame.preloadMainBetText = preloadFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
preloadFrame.preloadMainBetText:SetPoint("LEFT", preloadFrame, 12, 30)
preloadFrame.preloadMainBetText:SetJustifyH("LEFT")
preloadFrame.preloadMainBetText:SetText("Main Bet:")
preloadFrame.preloadMainBetText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
preloadFrame.preloadMainBetText:Hide()
-- PP Side Bet Text
preloadFrame.preloadPPBetText = preloadFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
preloadFrame.preloadPPBetText:SetPoint("LEFT", preloadFrame, 12, 8)
preloadFrame.preloadPPBetText:SetJustifyH("LEFT")
preloadFrame.preloadPPBetText:SetText("PP Side Bet:")
preloadFrame.preloadPPBetText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
preloadFrame.preloadPPBetText:Hide()
-- PP Side Bet Text
preloadFrame.preload213BetText = preloadFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
preloadFrame.preload213BetText:SetPoint("LEFT", preloadFrame, 12, -14)
preloadFrame.preload213BetText:SetJustifyH("LEFT")
preloadFrame.preload213BetText:SetText("21+3 Side Bet:")
preloadFrame.preload213BetText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
preloadFrame.preload213BetText:Hide()

-- Wagers for Player 1
-- Main Bet
player1PreloadEditBoxMainBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player1PreloadEditBoxMainBet:SetSize(55, 30)
player1PreloadEditBoxMainBet:SetPoint("LEFT", preloadFrame, 102, 30)
player1PreloadEditBoxMainBet:SetAutoFocus(false)
player1PreloadEditBoxMainBet:SetNumeric(true)
player1PreloadEditBoxMainBet:Hide()
-- Perfect Pairs
player1PreloadEditBoxPPBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player1PreloadEditBoxPPBet:SetSize(35, 30)
player1PreloadEditBoxPPBet:SetPoint("LEFT", preloadFrame, 121, 8)
player1PreloadEditBoxPPBet:SetAutoFocus(false)
player1PreloadEditBoxPPBet:SetNumeric(true)
player1PreloadEditBoxPPBet:Hide()
-- 21+3
player1PreloadEditBox213Bet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player1PreloadEditBox213Bet:SetSize(35, 30)
player1PreloadEditBox213Bet:SetPoint("LEFT", preloadFrame, 121, -14)
player1PreloadEditBox213Bet:SetAutoFocus(false)
player1PreloadEditBox213Bet:SetNumeric(true)
player1PreloadEditBox213Bet:Hide()
-- Player 1 Preload Bet button
player1PreloadBetButton = CreateFrame("Button", nil, preloadFrame, "GameMenuButtonTemplate")
player1PreloadBetButton:SetPoint("BOTTOM", preloadFrame, 1, 13)
player1PreloadBetButton:SetSize(85, 25)
player1PreloadBetButton:SetText("Bet All")
player1PreloadBetButton:Hide()

-- Wagers for Player 2
-- Main Bet
player2PreloadEditBoxMainBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player2PreloadEditBoxMainBet:SetSize(55, 30)
player2PreloadEditBoxMainBet:SetPoint("LEFT", preloadFrame, 102, 30)
player2PreloadEditBoxMainBet:SetAutoFocus(false)
player2PreloadEditBoxMainBet:SetNumeric(true)
player2PreloadEditBoxMainBet:Hide()
-- Perfect Pairs
player2PreloadEditBoxPPBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player2PreloadEditBoxPPBet:SetSize(35, 30)
player2PreloadEditBoxPPBet:SetPoint("LEFT", preloadFrame, 121, 8)
player2PreloadEditBoxPPBet:SetAutoFocus(false)
player2PreloadEditBoxPPBet:SetNumeric(true)
player2PreloadEditBoxPPBet:Hide()
-- 21+3
player2PreloadEditBox213Bet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player2PreloadEditBox213Bet:SetSize(35, 30)
player2PreloadEditBox213Bet:SetPoint("LEFT", preloadFrame, 121, -14)
player2PreloadEditBox213Bet:SetAutoFocus(false)
player2PreloadEditBox213Bet:SetNumeric(true)
player2PreloadEditBox213Bet:Hide()
-- Player 2 Preload Bet button
player2PreloadBetButton = CreateFrame("Button", nil, preloadFrame, "GameMenuButtonTemplate")
player2PreloadBetButton:SetPoint("BOTTOM", preloadFrame, 1, 13)
player2PreloadBetButton:SetSize(85, 25)
player2PreloadBetButton:SetText("Bet All")
player2PreloadBetButton:Hide()

-- Wagers for Player 3
-- Main Bet
player3PreloadEditBoxMainBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player3PreloadEditBoxMainBet:SetSize(55, 30)
player3PreloadEditBoxMainBet:SetPoint("LEFT", preloadFrame, 102, 30)
player3PreloadEditBoxMainBet:SetAutoFocus(false)
player3PreloadEditBoxMainBet:SetNumeric(true)
player3PreloadEditBoxMainBet:Hide()
-- Perfect Pairs
player3PreloadEditBoxPPBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player3PreloadEditBoxPPBet:SetSize(35, 30)
player3PreloadEditBoxPPBet:SetPoint("LEFT", preloadFrame, 121, 8)
player3PreloadEditBoxPPBet:SetAutoFocus(false)
player3PreloadEditBoxPPBet:SetNumeric(true)
player3PreloadEditBoxPPBet:Hide()
-- 21+3
player3PreloadEditBox213Bet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player3PreloadEditBox213Bet:SetSize(35, 30)
player3PreloadEditBox213Bet:SetPoint("LEFT", preloadFrame, 121, -14)
player3PreloadEditBox213Bet:SetAutoFocus(false)
player3PreloadEditBox213Bet:SetNumeric(true)
player3PreloadEditBox213Bet:Hide()
-- Player 2 Preload Bet button
player3PreloadBetButton = CreateFrame("Button", nil, preloadFrame, "GameMenuButtonTemplate")
player3PreloadBetButton:SetPoint("BOTTOM", preloadFrame, 1, 13)
player3PreloadBetButton:SetSize(85, 25)
player3PreloadBetButton:SetText("Bet All")
player3PreloadBetButton:Hide()

-- Wagers for Player 4
-- Main Bet
player4PreloadEditBoxMainBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player4PreloadEditBoxMainBet:SetSize(55, 30)
player4PreloadEditBoxMainBet:SetPoint("LEFT", preloadFrame, 102, 30)
player4PreloadEditBoxMainBet:SetAutoFocus(false)
player4PreloadEditBoxMainBet:SetNumeric(true)
player4PreloadEditBoxMainBet:Hide()
-- Perfect Pairs
player4PreloadEditBoxPPBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player4PreloadEditBoxPPBet:SetSize(35, 30)
player4PreloadEditBoxPPBet:SetPoint("LEFT", preloadFrame, 121, 8)
player4PreloadEditBoxPPBet:SetAutoFocus(false)
player4PreloadEditBoxPPBet:SetNumeric(true)
player4PreloadEditBoxPPBet:Hide()
-- 21+3
player4PreloadEditBox213Bet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player4PreloadEditBox213Bet:SetSize(35, 30)
player4PreloadEditBox213Bet:SetPoint("LEFT", preloadFrame, 121, -14)
player4PreloadEditBox213Bet:SetAutoFocus(false)
player4PreloadEditBox213Bet:SetNumeric(true)
player4PreloadEditBox213Bet:Hide()
-- Player 2 Preload Bet button
player4PreloadBetButton = CreateFrame("Button", nil, preloadFrame, "GameMenuButtonTemplate")
player4PreloadBetButton:SetPoint("BOTTOM", preloadFrame, 1, 13)
player4PreloadBetButton:SetSize(85, 25)
player4PreloadBetButton:SetText("Bet All")
player4PreloadBetButton:Hide()

-- Wagers for Player 5
-- Main Bet
player5PreloadEditBoxMainBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player5PreloadEditBoxMainBet:SetSize(55, 30)
player5PreloadEditBoxMainBet:SetPoint("LEFT", preloadFrame, 102, 30)
player5PreloadEditBoxMainBet:SetAutoFocus(false)
player5PreloadEditBoxMainBet:SetNumeric(true)
player5PreloadEditBoxMainBet:Hide()
-- Perfect Pairs
player5PreloadEditBoxPPBet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player5PreloadEditBoxPPBet:SetSize(35, 30)
player5PreloadEditBoxPPBet:SetPoint("LEFT", preloadFrame, 121, 8)
player5PreloadEditBoxPPBet:SetAutoFocus(false)
player5PreloadEditBoxPPBet:SetNumeric(true)
player5PreloadEditBoxPPBet:Hide()
-- 21+3
player5PreloadEditBox213Bet = CreateFrame("EditBox", nil, preloadFrame, "InputBoxTemplate")
player5PreloadEditBox213Bet:SetSize(35, 30)
player5PreloadEditBox213Bet:SetPoint("LEFT", preloadFrame, 121, -14)
player5PreloadEditBox213Bet:SetAutoFocus(false)
player5PreloadEditBox213Bet:SetNumeric(true)
player5PreloadEditBox213Bet:Hide()
-- Player 2 Preload Bet button
player5PreloadBetButton = CreateFrame("Button", nil, preloadFrame, "GameMenuButtonTemplate")
player5PreloadBetButton:SetPoint("BOTTOM", preloadFrame, 1, 13)
player5PreloadBetButton:SetSize(85, 25)
player5PreloadBetButton:SetText("Bet All")
player5PreloadBetButton:Hide()
























-- >> HISTORY WINDOW <<
-- >> HISTORY WINDOW <<
-- >> HISTORY WINDOW <<

-- History window
historyFrame = CreateFrame("Frame", "BlackjackHistoryFrame", UIParent, "InsetFrameTemplate")
historyFrame:SetSize(246, 105)
historyFrame:SetPoint("TOP", playerFrame, 2, -26)
historyFrame:SetFrameStrata("HIGH")
historyFrame:SetFrameLevel(8)
historyFrame:Hide()

-- Setting a title
historyFrame.title = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.title:SetPoint("TOP", historyFrame, 0, -9)
historyFrame.title:SetText("Profit/Loss")

-- Total Wagered Text
historyFrame.totalWageredText = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.totalWageredText:SetPoint("CENTER", historyFrame, -42, 12)
historyFrame.totalWageredText:SetJustifyH("RIGHT")
historyFrame.totalWageredText:SetText("Total Wagered:")
historyFrame.totalWageredText:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.totalWageredText:Hide()

-- Total Wagered Amount
historyFrame.player1totalWageredAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player1totalWageredAmount:SetPoint("CENTER", historyFrame, 40, 12)
historyFrame.player1totalWageredAmount:SetJustifyH("LEFT")
historyFrame.player1totalWageredAmount:SetText("0 G")
historyFrame.player1totalWageredAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player1totalWageredAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player1totalWageredAmount:Hide()

historyFrame.player2totalWageredAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player2totalWageredAmount:SetPoint("CENTER", historyFrame, 40, 12)
historyFrame.player2totalWageredAmount:SetJustifyH("LEFT")
historyFrame.player2totalWageredAmount:SetText("0 G")
historyFrame.player2totalWageredAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player2totalWageredAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player2totalWageredAmount:Hide()

historyFrame.player3totalWageredAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player3totalWageredAmount:SetPoint("CENTER", historyFrame, 40, 12)
historyFrame.player3totalWageredAmount:SetJustifyH("LEFT")
historyFrame.player3totalWageredAmount:SetText("0 G")
historyFrame.player3totalWageredAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player3totalWageredAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player3totalWageredAmount:Hide()

historyFrame.player4totalWageredAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player4totalWageredAmount:SetPoint("CENTER", historyFrame, 40, 12)
historyFrame.player4totalWageredAmount:SetJustifyH("LEFT")
historyFrame.player4totalWageredAmount:SetText("0 G")
historyFrame.player4totalWageredAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player4totalWageredAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player4totalWageredAmount:Hide()

historyFrame.player5totalWageredAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player5totalWageredAmount:SetPoint("CENTER", historyFrame, 40, 12)
historyFrame.player5totalWageredAmount:SetJustifyH("LEFT")
historyFrame.player5totalWageredAmount:SetText("0 G")
historyFrame.player5totalWageredAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player5totalWageredAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player5totalWageredAmount:Hide()

-- Total Won Text
historyFrame.totalWonText = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.totalWonText:SetPoint("CENTER", historyFrame, -30, -3)
historyFrame.totalWonText:SetJustifyH("RIGHT")
historyFrame.totalWonText:SetText("Total Won:")
historyFrame.totalWonText:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.totalWonText:Hide()

-- Total Won Amount
historyFrame.player1totalWonAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player1totalWonAmount:SetPoint("CENTER", historyFrame, 40, -3)
historyFrame.player1totalWonAmount:SetJustifyH("LEFT")
historyFrame.player1totalWonAmount:SetText("0 G")
historyFrame.player1totalWonAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player1totalWonAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player1totalWonAmount:Hide()

historyFrame.player2totalWonAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player2totalWonAmount:SetPoint("CENTER", historyFrame, 40, -3)
historyFrame.player2totalWonAmount:SetJustifyH("LEFT")
historyFrame.player2totalWonAmount:SetText("0 G")
historyFrame.player2totalWonAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player2totalWonAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player2totalWonAmount:Hide()

historyFrame.player3totalWonAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player3totalWonAmount:SetPoint("CENTER", historyFrame, 40, -3)
historyFrame.player3totalWonAmount:SetJustifyH("LEFT")
historyFrame.player3totalWonAmount:SetText("0 G")
historyFrame.player3totalWonAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player3totalWonAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player3totalWonAmount:Hide()

historyFrame.player4totalWonAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player4totalWonAmount:SetPoint("CENTER", historyFrame, 40, -3)
historyFrame.player4totalWonAmount:SetJustifyH("LEFT")
historyFrame.player4totalWonAmount:SetText("0 G")
historyFrame.player4totalWonAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player4totalWonAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player4totalWonAmount:Hide()

historyFrame.player5totalWonAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player5totalWonAmount:SetPoint("CENTER", historyFrame, 40, -3)
historyFrame.player5totalWonAmount:SetJustifyH("LEFT")
historyFrame.player5totalWonAmount:SetText("0 G")
historyFrame.player5totalWonAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player5totalWonAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player5totalWonAmount:Hide()

-- Total Lost Text
historyFrame.totalLostText = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.totalLostText:SetPoint("CENTER", historyFrame, -28, -18)
historyFrame.totalLostText:SetJustifyH("RIGHT")
historyFrame.totalLostText:SetText("Total Lost:")
historyFrame.totalLostText:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.totalLostText:Hide()

-- Total Lost Amount
historyFrame.player1totalLostAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player1totalLostAmount:SetPoint("CENTER", historyFrame, 40, -18)
historyFrame.player1totalLostAmount:SetJustifyH("LEFT")
historyFrame.player1totalLostAmount:SetText("0 G")
historyFrame.player1totalLostAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player1totalLostAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player1totalLostAmount:Hide()

historyFrame.player2totalLostAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player2totalLostAmount:SetPoint("CENTER", historyFrame, 40, -18)
historyFrame.player2totalLostAmount:SetJustifyH("LEFT")
historyFrame.player2totalLostAmount:SetText("0 G")
historyFrame.player2totalLostAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player2totalLostAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player2totalLostAmount:Hide()

historyFrame.player3totalLostAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player3totalLostAmount:SetPoint("CENTER", historyFrame, 40, -18)
historyFrame.player3totalLostAmount:SetJustifyH("LEFT")
historyFrame.player3totalLostAmount:SetText("0 G")
historyFrame.player3totalLostAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player3totalLostAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player3totalLostAmount:Hide()

historyFrame.player4totalLostAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player4totalLostAmount:SetPoint("CENTER", historyFrame, 40, -18)
historyFrame.player4totalLostAmount:SetJustifyH("LEFT")
historyFrame.player4totalLostAmount:SetText("0 G")
historyFrame.player4totalLostAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player4totalLostAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player4totalLostAmount:Hide()

historyFrame.player5totalLostAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player5totalLostAmount:SetPoint("CENTER", historyFrame, 40, -18)
historyFrame.player5totalLostAmount:SetJustifyH("LEFT")
historyFrame.player5totalLostAmount:SetText("0 G")
historyFrame.player5totalLostAmount:SetTextColor(1, 0.98, 0.557)
historyFrame.player5totalLostAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player5totalLostAmount:Hide()

-- Profit Text
historyFrame.ProfitText = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.ProfitText:SetPoint("CENTER", historyFrame, -16, -33)
historyFrame.ProfitText:SetJustifyH("RIGHT")
historyFrame.ProfitText:SetText("Profit:")
historyFrame.ProfitText:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.ProfitText:Hide()

-- Total Profit Amount
historyFrame.player1ProfitAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player1ProfitAmount:SetPoint("CENTER", historyFrame, 40, -33)
historyFrame.player1ProfitAmount:SetJustifyH("LEFT")
historyFrame.player1ProfitAmount:SetText("0 G")
historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
historyFrame.player1ProfitAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player1ProfitAmount:Hide()

historyFrame.player2ProfitAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player2ProfitAmount:SetPoint("CENTER", historyFrame, 40, -33)
historyFrame.player2ProfitAmount:SetJustifyH("LEFT")
historyFrame.player2ProfitAmount:SetText("0 G")
historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
historyFrame.player2ProfitAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player2ProfitAmount:Hide()

historyFrame.player3ProfitAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player3ProfitAmount:SetPoint("CENTER", historyFrame, 40, -33)
historyFrame.player3ProfitAmount:SetJustifyH("LEFT")
historyFrame.player3ProfitAmount:SetText("0 G")
historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
historyFrame.player3ProfitAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player3ProfitAmount:Hide()

historyFrame.player4ProfitAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player4ProfitAmount:SetPoint("CENTER", historyFrame, 40, -33)
historyFrame.player4ProfitAmount:SetJustifyH("LEFT")
historyFrame.player4ProfitAmount:SetText("0 G")
historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
historyFrame.player4ProfitAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player4ProfitAmount:Hide()

historyFrame.player5ProfitAmount = historyFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
historyFrame.player5ProfitAmount:SetPoint("CENTER", historyFrame, 40, -33)
historyFrame.player5ProfitAmount:SetJustifyH("LEFT")
historyFrame.player5ProfitAmount:SetText("0 G")
historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
historyFrame.player5ProfitAmount:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
historyFrame.player5ProfitAmount:Hide()



















-- >> RULES WINDOW <<
-- >> RULES WINDOW <<
-- >> RULES WINDOW <<

-- Rules window
-- Creating the rulesFrame
rulesFrame = CreateFrame("Frame", "BlackjackPayoutsFrame", UIParent, "InsetFrameTemplate")
rulesFrame:SetSize(900, 546)
rulesFrame:SetPoint("CENTER", playerFrame, 0, 0)
rulesFrame:SetFrameStrata("HIGH")
rulesFrame:SetFrameLevel(10)
rulesFrame:Hide()

-- Setting a title
rulesFrame.title = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.title:SetPoint("TOP", rulesFrame, 0, -8)
rulesFrame.title:SetText("Blackjack Rules")

-- Text1
rulesFrame.rulesText1 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText1:SetPoint("TOP", rulesFrame, 20, -50)
rulesFrame.rulesText1:SetJustifyH("CENTER")
rulesFrame.rulesText1:SetText("Blackjack (otherwise known as '21') is a popular card game. The goal is to beat the dealer by having\n a hand value closer to 21 than the dealer's hand, without going over 21. Here are the basic rules:")
rulesFrame.rulesText1:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
rulesFrame.rulesText1:Hide()

-- "Card Values" Heading
rulesFrame.HeadingText1 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText1:SetPoint("CENTER", rulesFrame, -340, 150)
rulesFrame.HeadingText1:SetJustifyH("CENTER")
rulesFrame.HeadingText1:SetText("1. Card Values")
rulesFrame.HeadingText1:SetTextColor(1, 0.298, 0.298)
rulesFrame.HeadingText1:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
rulesFrame.HeadingText1:Hide()

-- Text2
rulesFrame.rulesText2 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText2:SetPoint("CENTER", rulesFrame, -231, 100)
rulesFrame.rulesText2:SetJustifyH("LEFT")
rulesFrame.rulesText2:SetText("• Number cards (2-10) are worth their face value\n• Face cards (Jack, Queen, King) are each worth 10 points\n• Aces can be worth 1 or 11 points\n\nThe dealer uses the '/roll 1-13' in-game command\nto decide the card, which ensures a 100% random result")
rulesFrame.rulesText2:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText2:Hide()

-- Text3
rulesFrame.rulesText3 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText3:SetPoint("CENTER", rulesFrame, -353, 10)
rulesFrame.rulesText3:SetJustifyH("LEFT")
rulesFrame.rulesText3:SetTextColor(0.969, 0.961, 0.42)
rulesFrame.rulesText3:SetText("1 = 1 or 11 (Ace)\n2 = 2\n3 = 3\n4 = 4\n5 = 5\n6 = 6\n7 = 7")
rulesFrame.rulesText3:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText3:Hide()

-- Text4
rulesFrame.rulesText4 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText4:SetPoint("CENTER", rulesFrame, -210, 15)
rulesFrame.rulesText4:SetJustifyH("LEFT")
rulesFrame.rulesText4:SetTextColor(0.969, 0.961, 0.42)
rulesFrame.rulesText4:SetText("8 = 8\n9 = 9\n10 = 10\n11 = 10 (Jack)\n12 = 10 (Queen)\n13 = 10 (King)")
rulesFrame.rulesText4:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText4:Hide()

-- "Starting the Game" Heading
rulesFrame.HeadingText2 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText2:SetPoint("CENTER", rulesFrame, -308, -65)
rulesFrame.HeadingText2:SetJustifyH("CENTER")
rulesFrame.HeadingText2:SetText("2. Starting the Game")
rulesFrame.HeadingText2:SetTextColor(1, 0.298, 0.298)
rulesFrame.HeadingText2:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
rulesFrame.HeadingText2:Hide()

-- Text5
rulesFrame.rulesText5 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText5:SetPoint("CENTER", rulesFrame, -229, -105)
rulesFrame.rulesText5:SetJustifyH("LEFT")
rulesFrame.rulesText5:SetText("• Players place their bets (within the table limits) and trade\n the dealer the total amount of gold\n• Each player receives two cards - the dealer only receives\n one card (known as the 'upcard')")
rulesFrame.rulesText5:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText5:Hide()

-- "Player's Turn" Heading
rulesFrame.HeadingText3 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText3:SetPoint("CENTER", rulesFrame, -333, -160)
rulesFrame.HeadingText3:SetJustifyH("CENTER")
rulesFrame.HeadingText3:SetText("3. Player's Turn")
rulesFrame.HeadingText3:SetTextColor(1, 0.298, 0.298)
rulesFrame.HeadingText3:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
rulesFrame.HeadingText3:Hide()

-- Text6
rulesFrame.rulesText6 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText6:SetPoint("CENTER", rulesFrame, -233, -206)
rulesFrame.rulesText6:SetJustifyH("LEFT")
rulesFrame.rulesText6:SetText("• Players decide to 'Hit' (take another card), 'Stand'\n (keep their current total) or 'Double' (double their bet for\n one extra card only)\n• Players can continue to hit as many times as they like\n but if they exceed 21, they bust and lose the round")
rulesFrame.rulesText6:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText6:Hide()

-- "Dealer's Turn" Heading
rulesFrame.HeadingText4 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText4:SetPoint("CENTER", rulesFrame, 124, 150)
rulesFrame.HeadingText4:SetJustifyH("CENTER")
rulesFrame.HeadingText4:SetText("4. Dealer's Turn")
rulesFrame.HeadingText4:SetTextColor(1, 0.298, 0.298)
rulesFrame.HeadingText4:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
rulesFrame.HeadingText4:Hide()

-- Text7
rulesFrame.rulesText7 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText7:SetPoint("CENTER", rulesFrame, 217, 117)
rulesFrame.rulesText7:SetJustifyH("LEFT")
rulesFrame.rulesText7:SetText("• Once all players have finished their turns, the dealer\n will begin their turn\n• The dealer must hit until their hand totals 17 or higher")
rulesFrame.rulesText7:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText7:Hide()

-- "Win / Push / Loss" Heading
rulesFrame.HeadingText5 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText5:SetPoint("CENTER", rulesFrame, 145, 64)
rulesFrame.HeadingText5:SetJustifyH("CENTER")
rulesFrame.HeadingText5:SetText("5. Win / Push / Loss")
rulesFrame.HeadingText5:SetTextColor(1, 0.298, 0.298)
rulesFrame.HeadingText5:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
rulesFrame.HeadingText5:Hide()

-- "WIN" Heading
rulesFrame.HeadingText6 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText6:SetPoint("CENTER", rulesFrame, 70, 42)
rulesFrame.HeadingText6:SetJustifyH("CENTER")
rulesFrame.HeadingText6:SetText("WIN:")
rulesFrame.HeadingText6:SetTextColor(0.325, 0.98, 0.365)
rulesFrame.HeadingText6:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
rulesFrame.HeadingText6:Hide()

-- Text8
rulesFrame.rulesText8 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText8:SetPoint("CENTER", rulesFrame, 221, 1)
rulesFrame.rulesText8:SetJustifyH("LEFT")
rulesFrame.rulesText8:SetText("• If the players hand is closer to 21 (without going over)\n than the dealer\n• If the dealer busts (goes over 21)\n• If the player has Blackjack (see below) and the dealer's\n upcard is not an Ace or 10")
rulesFrame.rulesText8:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText8:Hide()

-- "PUSH" Heading
rulesFrame.HeadingText7 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText7:SetPoint("CENTER", rulesFrame, 75, -48)
rulesFrame.HeadingText7:SetJustifyH("CENTER")
rulesFrame.HeadingText7:SetText("PUSH:")
rulesFrame.HeadingText7:SetTextColor(0.275, 0.635, 1)
rulesFrame.HeadingText7:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
rulesFrame.HeadingText7:Hide()

-- Text9
rulesFrame.rulesText9 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText9:SetPoint("CENTER", rulesFrame, 217, -72)
rulesFrame.rulesText9:SetJustifyH("LEFT")
rulesFrame.rulesText9:SetText("• If the player and dealer have the same hand value, it's\n a push (a tie), and the players bet is returned")
rulesFrame.rulesText9:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText9:Hide()

-- "LOSS" Heading
rulesFrame.HeadingText8 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText8:SetPoint("CENTER", rulesFrame, 74, -105)
rulesFrame.HeadingText8:SetJustifyH("CENTER")
rulesFrame.HeadingText8:SetText("LOSS:")
rulesFrame.HeadingText8:SetTextColor(1, 0.212, 0.212)
rulesFrame.HeadingText8:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
rulesFrame.HeadingText8:Hide()

-- Text10
rulesFrame.rulesText10 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText10:SetPoint("CENTER", rulesFrame, 204, -134)
rulesFrame.rulesText10:SetJustifyH("LEFT")
rulesFrame.rulesText10:SetText("• If the players hand is less than the dealer (without\n going over 21)\n• If the player busts (goes over 21)")
rulesFrame.rulesText10:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText10:Hide()

-- "Blackjack" Heading
rulesFrame.HeadingText9 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.HeadingText9:SetPoint("CENTER", rulesFrame, 107, -182)
rulesFrame.HeadingText9:SetJustifyH("CENTER")
rulesFrame.HeadingText9:SetText("6. Blackjack")
rulesFrame.HeadingText9:SetTextColor(1, 0.298, 0.298)
rulesFrame.HeadingText9:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")
rulesFrame.HeadingText9:Hide()

-- Text11
rulesFrame.rulesText11 = rulesFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
rulesFrame.rulesText11:SetPoint("CENTER", rulesFrame, 209, -217)
rulesFrame.rulesText11:SetJustifyH("LEFT")
rulesFrame.rulesText11:SetText("• A 'Blackjack' is a special hand consisting of an Ace\n and a 10-point card. It pays out at 3:2 instead of a\n regular 1:1 win")
rulesFrame.rulesText11:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
rulesFrame.rulesText11:Hide()



























-- >> PAYOUTS WINDOW <<
-- >> PAYOUTS WINDOW <<
-- >> PAYOUTS WINDOW <<

-- Payouts window
-- Creating the payoutsFrame
payoutsFrame = CreateFrame("Frame", "BlackjackPayoutsFrame", UIParent, "BasicFrameTemplateWithInset")
payoutsFrame:SetSize(275, 720)
payoutsFrame:SetPoint("LEFT", playerFrame, 0, 0)
payoutsFrame:SetFrameStrata("HIGH")
payoutsFrame:SetFrameLevel(8)
payoutsFrame:Hide()

-- Setting a title
payoutsFrame.title = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.title:SetPoint("TOP", payoutsFrame, 0, -5)
payoutsFrame.title:SetText("Payouts")

-- Headings
-- Main Bets
payoutsFrame.mainBetsTitle = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.mainBetsTitle:SetPoint("TOPLEFT", payoutsFrame, 15, -36)
payoutsFrame.mainBetsTitle:SetJustifyH("LEFT")
payoutsFrame.mainBetsTitle:SetText("Main Bets")
payoutsFrame.mainBetsTitle:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.mainBetsTitle:SetTextColor(1, 0, 0)
payoutsFrame.mainBetsTitle:Hide()
-- Side Bets
payoutsFrame.sideBetsTitle = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.sideBetsTitle:SetPoint("TOPLEFT", payoutsFrame, 15, -135)
payoutsFrame.sideBetsTitle:SetJustifyH("LEFT")
payoutsFrame.sideBetsTitle:SetText("Side Bets")
payoutsFrame.sideBetsTitle:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.sideBetsTitle:SetTextColor(1, 0, 0)
payoutsFrame.sideBetsTitle:Hide()
-- Perfect Pairs
payoutsFrame.perfectPairsTitle = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.perfectPairsTitle:SetPoint("TOPLEFT", payoutsFrame, 15, -155)
payoutsFrame.perfectPairsTitle:SetJustifyH("LEFT")
payoutsFrame.perfectPairsTitle:SetText("Perfect Pairs (PP)")
payoutsFrame.perfectPairsTitle:SetTextColor(1, 0.298, 0.298)
payoutsFrame.perfectPairsTitle:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
payoutsFrame.perfectPairsTitle:Hide()
-- Perfect Pairs (explain)
payoutsFrame.perfectPairsExplain = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.perfectPairsExplain:SetPoint("TOPLEFT", payoutsFrame, 152, -156)
payoutsFrame.perfectPairsExplain:SetJustifyH("LEFT")
payoutsFrame.perfectPairsExplain:SetText("(Player's 2 Cards)")
payoutsFrame.perfectPairsExplain:SetTextColor(1, 0.298, 0.298)
payoutsFrame.perfectPairsExplain:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
payoutsFrame.perfectPairsExplain:Hide()
-- 21+3
payoutsFrame.t213Title = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.t213Title:SetPoint("TOPLEFT", payoutsFrame, 15, -325)
payoutsFrame.t213Title:SetJustifyH("LEFT")
payoutsFrame.t213Title:SetText("21+3")
payoutsFrame.t213Title:SetTextColor(1, 0.298, 0.298)
payoutsFrame.t213Title:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
payoutsFrame.t213Title:Hide()
-- 21+3 (explain)
payoutsFrame.t213Explain = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.t213Explain:SetPoint("TOPLEFT", payoutsFrame, 62, -327)
payoutsFrame.t213Explain:SetJustifyH("LEFT")
payoutsFrame.t213Explain:SetText("(Player's 2 Cards + Dealer's Upcard)")
payoutsFrame.t213Explain:SetTextColor(1, 0.298, 0.298)
payoutsFrame.t213Explain:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
payoutsFrame.t213Explain:Hide()
-- 21+3 (explain) 2
payoutsFrame.t213Explain2 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.t213Explain2:SetPoint("TOPLEFT", payoutsFrame, 198, -370)
payoutsFrame.t213Explain2:SetJustifyH("RIGHT")
payoutsFrame.t213Explain2:SetText("Any Card\n\nSame Suit")
payoutsFrame.t213Explain2:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
payoutsFrame.t213Explain2:Hide()
-- 21+3 (explain) 3
payoutsFrame.t213Explain3 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.t213Explain3:SetPoint("TOPLEFT", payoutsFrame, 176, -444)
payoutsFrame.t213Explain3:SetJustifyH("RIGHT")
payoutsFrame.t213Explain3:SetText("Numeric Order\n\nAny Suit")
payoutsFrame.t213Explain3:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
payoutsFrame.t213Explain3:Hide()
-- 21+3 (explain) 4
payoutsFrame.t213Explain4 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.t213Explain4:SetPoint("TOPLEFT", payoutsFrame, 198, -519)
payoutsFrame.t213Explain4:SetJustifyH("RIGHT")
payoutsFrame.t213Explain4:SetText("Same Card\n\nAny Suit")
payoutsFrame.t213Explain4:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
payoutsFrame.t213Explain4:Hide()
-- 21+3 (explain) 5
payoutsFrame.t213Explain5 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.t213Explain5:SetPoint("TOPLEFT", payoutsFrame, 176, -589)
payoutsFrame.t213Explain5:SetJustifyH("RIGHT")
payoutsFrame.t213Explain5:SetText("Numeric Order\n\nSame Suit")
payoutsFrame.t213Explain5:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
payoutsFrame.t213Explain5:Hide()
-- 21+3 (explain) 6
payoutsFrame.t213Explain6 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.t213Explain6:SetPoint("TOPLEFT", payoutsFrame, 198, -663)
payoutsFrame.t213Explain6:SetJustifyH("RIGHT")
payoutsFrame.t213Explain6:SetText("Same Card\n\nSame Suit")
payoutsFrame.t213Explain6:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
payoutsFrame.t213Explain6:Hide()

-- Subheadings and Payouts
-- Standard
payoutsFrame.mainBetStandard = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.mainBetStandard:SetPoint("TOPLEFT", payoutsFrame, 15, -60)
payoutsFrame.mainBetStandard:SetJustifyH("LEFT")
payoutsFrame.mainBetStandard:SetText("Standard")
payoutsFrame.mainBetStandard:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.mainBetStandard:Hide()
-- Standard 1:1
payoutsFrame.standardPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.standardPayout:SetPoint("TOPLEFT", payoutsFrame, 87, -93)
payoutsFrame.standardPayout:SetJustifyH("LEFT")
payoutsFrame.standardPayout:SetText("1:1")
payoutsFrame.standardPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.standardPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.standardPayout:Hide()
-- Blackjack
payoutsFrame.mainBetBlackjack = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.mainBetBlackjack:SetPoint("TOPLEFT", payoutsFrame, 137, -60)
payoutsFrame.mainBetBlackjack:SetJustifyH("LEFT")
payoutsFrame.mainBetBlackjack:SetText("Blackjack")
payoutsFrame.mainBetBlackjack:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.mainBetBlackjack:Hide()
-- Blackjack 3:2
payoutsFrame.blackjackPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.blackjackPayout:SetPoint("TOPLEFT", payoutsFrame, 214, -93)
payoutsFrame.blackjackPayout:SetJustifyH("LEFT")
payoutsFrame.blackjackPayout:SetText("3:2")
payoutsFrame.blackjackPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.blackjackPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.blackjackPayout:Hide()
-- (PP) Mixed Pair
payoutsFrame.mixedPairPP = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.mixedPairPP:SetPoint("TOPLEFT", payoutsFrame, 15, -175)
payoutsFrame.mixedPairPP:SetJustifyH("LEFT")
payoutsFrame.mixedPairPP:SetText("Mixed Pair")
payoutsFrame.mixedPairPP:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.mixedPairPP:Hide()
-- (PP) Mixed Pair 5:1
payoutsFrame.mixedPairPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.mixedPairPayout:SetPoint("TOPLEFT", payoutsFrame, 89, -208)
payoutsFrame.mixedPairPayout:SetJustifyH("LEFT")
payoutsFrame.mixedPairPayout:SetText(mixedPairPayoutValue .. ":1")
payoutsFrame.mixedPairPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.mixedPairPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.mixedPairPayout:Hide()
-- (PP) Coloured Pair
payoutsFrame.colouredPairPP = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.colouredPairPP:SetPoint("TOPLEFT", payoutsFrame, 138, -175)
payoutsFrame.colouredPairPP:SetJustifyH("LEFT")
payoutsFrame.colouredPairPP:SetText("Coloured Pair")
payoutsFrame.colouredPairPP:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.colouredPairPP:Hide()
-- (PP) Coloured Pair 10:1
payoutsFrame.colouredPairPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.colouredPairPayout:SetPoint("TOPLEFT", payoutsFrame, 212, -208)
payoutsFrame.colouredPairPayout:SetJustifyH("LEFT")
payoutsFrame.colouredPairPayout:SetText(colouredPairPayoutValue .. ":1")
payoutsFrame.colouredPairPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.colouredPairPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.colouredPairPayout:Hide()
-- (PP) Perfect Pair
payoutsFrame.perfectPairPP = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.perfectPairPP:SetPoint("TOPLEFT", payoutsFrame, 15, -248)
payoutsFrame.perfectPairPP:SetJustifyH("LEFT")
payoutsFrame.perfectPairPP:SetText("Perfect Pair")
payoutsFrame.perfectPairPP:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.perfectPairPP:Hide()
-- (PP) Perfect Pair 25:1
payoutsFrame.perfectPairPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.perfectPairPayout:SetPoint("TOPLEFT", payoutsFrame, 89, -280)
payoutsFrame.perfectPairPayout:SetJustifyH("LEFT")
payoutsFrame.perfectPairPayout:SetText(perfectPairPayoutValue .. ":1")
payoutsFrame.perfectPairPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.perfectPairPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.perfectPairPayout:Hide()
-- Flush
payoutsFrame.flush213 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.flush213:SetPoint("TOPLEFT", payoutsFrame, 15, -345)
payoutsFrame.flush213:SetJustifyH("LEFT")
payoutsFrame.flush213:SetText("Flush")
payoutsFrame.flush213:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.flush213:Hide()
-- Flush 5:1
payoutsFrame.flushPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.flushPayout:SetPoint("TOPLEFT", payoutsFrame, 126, -377)
payoutsFrame.flushPayout:SetJustifyH("LEFT")
payoutsFrame.flushPayout:SetText(flushPayoutValue .. ":1")
payoutsFrame.flushPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.flushPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.flushPayout:Hide()
-- Straight
payoutsFrame.straight213 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.straight213:SetPoint("TOPLEFT", payoutsFrame, 15, -417)
payoutsFrame.straight213:SetJustifyH("LEFT")
payoutsFrame.straight213:SetText("Straight")
payoutsFrame.straight213:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.straight213:Hide()
-- Straight 10:1
payoutsFrame.straightPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.straightPayout:SetPoint("TOPLEFT", payoutsFrame, 125, -450)
payoutsFrame.straightPayout:SetJustifyH("LEFT")
payoutsFrame.straightPayout:SetText(straightPayoutValue .. ":1")
payoutsFrame.straightPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.straightPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.straightPayout:Hide()
-- Three of a Kind
payoutsFrame.threeOfAKind213 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.threeOfAKind213:SetPoint("TOPLEFT", payoutsFrame, 15, -491)
payoutsFrame.threeOfAKind213:SetJustifyH("LEFT")
payoutsFrame.threeOfAKind213:SetText("Three of a Kind")
payoutsFrame.threeOfAKind213:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.threeOfAKind213:Hide()
-- Three of a Kind 25:1
payoutsFrame.threeOfAKindPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.threeOfAKindPayout:SetPoint("TOPLEFT", payoutsFrame, 127, -525)
payoutsFrame.threeOfAKindPayout:SetJustifyH("LEFT")
payoutsFrame.threeOfAKindPayout:SetText(threeOfAKindPayoutValue .. ":1")
payoutsFrame.threeOfAKindPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.threeOfAKindPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.threeOfAKindPayout:Hide()
-- Straight Flush
payoutsFrame.straightFlush213 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.straightFlush213:SetPoint("TOPLEFT", payoutsFrame, 15, -563)
payoutsFrame.straightFlush213:SetJustifyH("LEFT")
payoutsFrame.straightFlush213:SetText("Straight Flush")
payoutsFrame.straightFlush213:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.straightFlush213:Hide()
-- Straight Flush 40:1
payoutsFrame.straightFlushPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.straightFlushPayout:SetPoint("TOPLEFT", payoutsFrame, 127, -595)
payoutsFrame.straightFlushPayout:SetJustifyH("LEFT")
payoutsFrame.straightFlushPayout:SetText(straightFlushPayoutValue .. ":1")
payoutsFrame.straightFlushPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.straightFlushPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.straightFlushPayout:Hide()
-- Suited Three of a Kind
payoutsFrame.suitedThreeOfAKind213 = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.suitedThreeOfAKind213:SetPoint("TOPLEFT", payoutsFrame, 15, -637)
payoutsFrame.suitedThreeOfAKind213:SetJustifyH("LEFT")
payoutsFrame.suitedThreeOfAKind213:SetText("Suited Three of a Kind")
payoutsFrame.suitedThreeOfAKind213:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
payoutsFrame.suitedThreeOfAKind213:Hide()
-- Suited Three of a Kind 100:1
payoutsFrame.suitedThreeOfAKindPayout = payoutsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
payoutsFrame.suitedThreeOfAKindPayout:SetPoint("TOPLEFT", payoutsFrame, 126, -669)
payoutsFrame.suitedThreeOfAKindPayout:SetJustifyH("LEFT")
payoutsFrame.suitedThreeOfAKindPayout:SetText(suitedThreeOfAKindPayoutValue .. ":1")
payoutsFrame.suitedThreeOfAKindPayout:SetTextColor(1, 0.973, 0.4)
payoutsFrame.suitedThreeOfAKindPayout:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
payoutsFrame.suitedThreeOfAKindPayout:Hide()

-- Creating card textures
-- Standard 1
payoutsFrame.card1image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card1image:SetSize(32, 64)
payoutsFrame.card1image:SetPoint("TOPLEFT", payoutsFrame, 17, -70)
payoutsFrame.card1image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\JH.tga")
payoutsFrame.card1image:SetBlendMode("BLEND")
payoutsFrame.card1image:SetDrawLayer("ARTWORK")
payoutsFrame.card1image:Hide()
-- Standard 2
payoutsFrame.card2image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card2image:SetSize(32, 64)
payoutsFrame.card2image:SetPoint("TOPLEFT", payoutsFrame, 52, -70)
payoutsFrame.card2image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\8S.tga")
payoutsFrame.card2image:SetBlendMode("BLEND")
payoutsFrame.card2image:SetDrawLayer("ARTWORK")
payoutsFrame.card2image:Hide()
-- Blackjack 1
payoutsFrame.card3image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card3image:SetSize(32, 64)
payoutsFrame.card3image:SetPoint("TOPLEFT", payoutsFrame, 140, -70)
payoutsFrame.card3image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\AS.tga")
payoutsFrame.card3image:SetBlendMode("BLEND")
payoutsFrame.card3image:SetDrawLayer("ARTWORK")
payoutsFrame.card3image:Hide()
-- Blackjack 2
payoutsFrame.card4image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card4image:SetSize(32, 64)
payoutsFrame.card4image:SetPoint("TOPLEFT", payoutsFrame, 176, -70)
payoutsFrame.card4image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\QD.tga")
payoutsFrame.card4image:SetBlendMode("BLEND")
payoutsFrame.card4image:SetDrawLayer("ARTWORK")
payoutsFrame.card4image:Hide()
-- (PP) Mixed Pair 1
payoutsFrame.card5image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card5image:SetSize(32, 64)
payoutsFrame.card5image:SetPoint("TOPLEFT", payoutsFrame, 17, -185)
payoutsFrame.card5image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\2C.tga")
payoutsFrame.card5image:SetBlendMode("BLEND")
payoutsFrame.card5image:SetDrawLayer("ARTWORK")
payoutsFrame.card5image:Hide()
-- (PP) Mixed Pair 2
payoutsFrame.card6image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card6image:SetSize(32, 64)
payoutsFrame.card6image:SetPoint("TOPLEFT", payoutsFrame, 52, -185)
payoutsFrame.card6image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\2D.tga")
payoutsFrame.card6image:SetBlendMode("BLEND")
payoutsFrame.card6image:SetDrawLayer("ARTWORK")
payoutsFrame.card6image:Hide()
-- (PP) Coloured Pair 1
payoutsFrame.card7image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card7image:SetSize(32, 64)
payoutsFrame.card7image:SetPoint("TOPLEFT", payoutsFrame, 140, -185)
payoutsFrame.card7image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\6S.tga")
payoutsFrame.card7image:SetBlendMode("BLEND")
payoutsFrame.card7image:SetDrawLayer("ARTWORK")
payoutsFrame.card7image:Hide()
-- (PP) Coloured Pair 2
payoutsFrame.card8image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card8image:SetSize(32, 64)
payoutsFrame.card8image:SetPoint("TOPLEFT", payoutsFrame, 176, -185)
payoutsFrame.card8image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\6C.tga")
payoutsFrame.card8image:SetBlendMode("BLEND")
payoutsFrame.card8image:SetDrawLayer("ARTWORK")
payoutsFrame.card8image:Hide()
-- (PP) Perfect Pair 1
payoutsFrame.card9image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card9image:SetSize(32, 64)
payoutsFrame.card9image:SetPoint("TOPLEFT", payoutsFrame, 17, -257)
payoutsFrame.card9image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\5D.tga")
payoutsFrame.card9image:SetBlendMode("BLEND")
payoutsFrame.card9image:SetDrawLayer("ARTWORK")
payoutsFrame.card9image:Hide()
-- (PP) Perfect Pair 2
payoutsFrame.card10image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card10image:SetSize(32, 64)
payoutsFrame.card10image:SetPoint("TOPLEFT", payoutsFrame, 52, -257)
payoutsFrame.card10image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\5D.tga")
payoutsFrame.card10image:SetBlendMode("BLEND")
payoutsFrame.card10image:SetDrawLayer("ARTWORK")
payoutsFrame.card10image:Hide()
-- (21+3) Flush 1
payoutsFrame.card11image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card11image:SetSize(32, 64)
payoutsFrame.card11image:SetPoint("TOPLEFT", payoutsFrame, 17, -354)
payoutsFrame.card11image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\3S.tga")
payoutsFrame.card11image:SetBlendMode("BLEND")
payoutsFrame.card11image:SetDrawLayer("ARTWORK")
payoutsFrame.card11image:Hide()
-- (21+3) Flush 2
payoutsFrame.card12image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card12image:SetSize(32, 64)
payoutsFrame.card12image:SetPoint("TOPLEFT", payoutsFrame, 52, -354)
payoutsFrame.card12image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\7S.tga")
payoutsFrame.card12image:SetBlendMode("BLEND")
payoutsFrame.card12image:SetDrawLayer("ARTWORK")
payoutsFrame.card12image:Hide()
-- (21+3) Flush 3
payoutsFrame.card13image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card13image:SetSize(32, 64)
payoutsFrame.card13image:SetPoint("TOPLEFT", payoutsFrame, 88, -354)
payoutsFrame.card13image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\QS.tga")
payoutsFrame.card13image:SetBlendMode("BLEND")
payoutsFrame.card13image:SetDrawLayer("ARTWORK")
payoutsFrame.card13image:Hide()
-- (21+3) Straight 1
payoutsFrame.card14image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card14image:SetSize(32, 64)
payoutsFrame.card14image:SetPoint("TOPLEFT", payoutsFrame, 17, -426)
payoutsFrame.card14image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\2H.tga")
payoutsFrame.card14image:SetBlendMode("BLEND")
payoutsFrame.card14image:SetDrawLayer("ARTWORK")
payoutsFrame.card14image:Hide()
-- (21+3) Straight 2
payoutsFrame.card15image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card15image:SetSize(32, 64)
payoutsFrame.card15image:SetPoint("TOPLEFT", payoutsFrame, 52, -426)
payoutsFrame.card15image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\3C.tga")
payoutsFrame.card15image:SetBlendMode("BLEND")
payoutsFrame.card15image:SetDrawLayer("ARTWORK")
payoutsFrame.card15image:Hide()
-- (21+3) Straight 3
payoutsFrame.card16image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card16image:SetSize(32, 64)
payoutsFrame.card16image:SetPoint("TOPLEFT", payoutsFrame, 88, -426)
payoutsFrame.card16image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\4D.tga")
payoutsFrame.card16image:SetBlendMode("BLEND")
payoutsFrame.card16image:SetDrawLayer("ARTWORK")
payoutsFrame.card16image:Hide()
-- (21+3) Three of a Kind 1
payoutsFrame.card17image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card17image:SetSize(32, 64)
payoutsFrame.card17image:SetPoint("TOPLEFT", payoutsFrame, 17, -500)
payoutsFrame.card17image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\AC.tga")
payoutsFrame.card17image:SetBlendMode("BLEND")
payoutsFrame.card17image:SetDrawLayer("ARTWORK")
payoutsFrame.card17image:Hide()
-- (21+3) Three of a Kind 2
payoutsFrame.card18image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card18image:SetSize(32, 64)
payoutsFrame.card18image:SetPoint("TOPLEFT", payoutsFrame, 52, -500)
payoutsFrame.card18image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\AD.tga")
payoutsFrame.card18image:SetBlendMode("BLEND")
payoutsFrame.card18image:SetDrawLayer("ARTWORK")
payoutsFrame.card18image:Hide()
-- (21+3) Three of a Kind 3
payoutsFrame.card19image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card19image:SetSize(32, 64)
payoutsFrame.card19image:SetPoint("TOPLEFT", payoutsFrame, 88, -500)
payoutsFrame.card19image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\AH.tga")
payoutsFrame.card19image:SetBlendMode("BLEND")
payoutsFrame.card19image:SetDrawLayer("ARTWORK")
payoutsFrame.card19image:Hide()
-- (21+3) Straight Flush 1
payoutsFrame.card20image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card20image:SetSize(32, 64)
payoutsFrame.card20image:SetPoint("TOPLEFT", payoutsFrame, 17, -572)
payoutsFrame.card20image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\2D.tga")
payoutsFrame.card20image:SetBlendMode("BLEND")
payoutsFrame.card20image:SetDrawLayer("ARTWORK")
payoutsFrame.card20image:Hide()
-- (21+3) Straight Flush 2
payoutsFrame.card21image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card21image:SetSize(32, 64)
payoutsFrame.card21image:SetPoint("TOPLEFT", payoutsFrame, 52, -572)
payoutsFrame.card21image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\3D.tga")
payoutsFrame.card21image:SetBlendMode("BLEND")
payoutsFrame.card21image:SetDrawLayer("ARTWORK")
payoutsFrame.card21image:Hide()
-- (21+3) Straight Flush 3
payoutsFrame.card22image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card22image:SetSize(32, 64)
payoutsFrame.card22image:SetPoint("TOPLEFT", payoutsFrame, 88, -572)
payoutsFrame.card22image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\4D.tga")
payoutsFrame.card22image:SetBlendMode("BLEND")
payoutsFrame.card22image:SetDrawLayer("ARTWORK")
payoutsFrame.card22image:Hide()
-- (21+3) Suited Three of a Kind 1
payoutsFrame.card23image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card23image:SetSize(32, 64)
payoutsFrame.card23image:SetPoint("TOPLEFT", payoutsFrame, 17, -646)
payoutsFrame.card23image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\AS.tga")
payoutsFrame.card23image:SetBlendMode("BLEND")
payoutsFrame.card23image:SetDrawLayer("ARTWORK")
payoutsFrame.card23image:Hide()
-- (21+3) Suited Three of a Kind 2
payoutsFrame.card24image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card24image:SetSize(32, 64)
payoutsFrame.card24image:SetPoint("TOPLEFT", payoutsFrame, 52, -646)
payoutsFrame.card24image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\AS.tga")
payoutsFrame.card24image:SetBlendMode("BLEND")
payoutsFrame.card24image:SetDrawLayer("ARTWORK")
payoutsFrame.card24image:Hide()
-- (21+3) Suited Three of a Kind 3
payoutsFrame.card25image = payoutsFrame:CreateTexture(nil, "OVERLAY")
payoutsFrame.card25image:SetSize(32, 64)
payoutsFrame.card25image:SetPoint("TOPLEFT", payoutsFrame, 88, -646)
payoutsFrame.card25image:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\AS.tga")
payoutsFrame.card25image:SetBlendMode("BLEND")
payoutsFrame.card25image:SetDrawLayer("ARTWORK")
payoutsFrame.card25image:Hide()
























-- >> DEALT CARDS WINDOW <<
-- >> DEALT CARDS WINDOW <<
-- >> DEALT CARDS WINDOW <<

-- >> PLAYER 1 <<
-- >> PLAYER 1 <<
-- >> PLAYER 1 <<

-- Player Dealt Cards Frame
player1dealtCardsFrame= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player1dealtCardsFrame:SetSize(656, 200)
player1dealtCardsFrame:SetPoint("BOTTOM", playerFrame, 0, 5)
player1dealtCardsFrame:SetFrameStrata("HIGH")
player1dealtCardsFrame:SetFrameLevel(6)
player1dealtCardsFrame:Hide()

-- "Player" button which displays Player's Main Hand cards
player1dealtCardsFrame.playerCardsButton = CreateFrame("Button", nil, player1dealtCardsFrame, "GameMenuButtonTemplate")
player1dealtCardsFrame.playerCardsButton:SetPoint("TOPLEFT", player1dealtCardsFrame, 8, -8)
player1dealtCardsFrame.playerCardsButton:SetSize(75, 25)
player1dealtCardsFrame.playerCardsButton:SetText("Player")
player1dealtCardsFrame.playerCardsButton:Disable()
player1dealtCardsFrame.playerCardsButton:Hide()

player1dealtCardsFrame.notStartedYetText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.notStartedYetText:SetPoint("CENTER", player1dealtCardsFrame, 0, 0)
player1dealtCardsFrame.notStartedYetText:SetJustifyH("CENTER")
player1dealtCardsFrame.notStartedYetText:SetText("The round hasn't started yet")
player1dealtCardsFrame.notStartedYetText:SetFont("Fonts\\FRIZQT__.TTF", 20, "OUTLINE")
player1dealtCardsFrame.notStartedYetText:Hide()

player1dealtCardsFrame.player1MainCardImage1 = player1dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrame.player1MainCardImage1:SetSize(85, 170)
player1dealtCardsFrame.player1MainCardImage1:SetPoint("LEFT", player1dealtCardsFrame, 10, -7)
player1dealtCardsFrame.player1MainCardImage1:SetBlendMode("BLEND")
player1dealtCardsFrame.player1MainCardImage1:SetDrawLayer("ARTWORK")

player1dealtCardsFrame.player1MainCardImage2 = player1dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrame.player1MainCardImage2:SetSize(85, 170)
player1dealtCardsFrame.player1MainCardImage2:SetPoint("LEFT", player1dealtCardsFrame, 102, -7)
player1dealtCardsFrame.player1MainCardImage2:SetBlendMode("BLEND")
player1dealtCardsFrame.player1MainCardImage2:SetDrawLayer("ARTWORK")

player1dealtCardsFrame.player1MainCardImage3 = player1dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrame.player1MainCardImage3:SetSize(85, 170)
player1dealtCardsFrame.player1MainCardImage3:SetPoint("LEFT", player1dealtCardsFrame, 194, -7)
player1dealtCardsFrame.player1MainCardImage3:SetBlendMode("BLEND")
player1dealtCardsFrame.player1MainCardImage3:SetDrawLayer("ARTWORK")

player1dealtCardsFrame.player1MainCardImage4 = player1dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrame.player1MainCardImage4:SetSize(85, 170)
player1dealtCardsFrame.player1MainCardImage4:SetPoint("LEFT", player1dealtCardsFrame, 286, -7)
player1dealtCardsFrame.player1MainCardImage4:SetBlendMode("BLEND")
player1dealtCardsFrame.player1MainCardImage4:SetDrawLayer("ARTWORK")

player1dealtCardsFrame.player1MainCardImage5 = player1dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrame.player1MainCardImage5:SetSize(85, 170)
player1dealtCardsFrame.player1MainCardImage5:SetPoint("LEFT", player1dealtCardsFrame, 378, -7)
player1dealtCardsFrame.player1MainCardImage5:SetBlendMode("BLEND")
player1dealtCardsFrame.player1MainCardImage5:SetDrawLayer("ARTWORK")

player1dealtCardsFrame.player1MainCardImage6 = player1dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrame.player1MainCardImage6:SetSize(85, 170)
player1dealtCardsFrame.player1MainCardImage6:SetPoint("LEFT", player1dealtCardsFrame, 470, -7)
player1dealtCardsFrame.player1MainCardImage6:SetBlendMode("BLEND")
player1dealtCardsFrame.player1MainCardImage6:SetDrawLayer("ARTWORK")

player1dealtCardsFrame.player1MainCardImage7 = player1dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrame.player1MainCardImage7:SetSize(85, 170)
player1dealtCardsFrame.player1MainCardImage7:SetPoint("LEFT", player1dealtCardsFrame, 562, -7)
player1dealtCardsFrame.player1MainCardImage7:SetBlendMode("BLEND")
player1dealtCardsFrame.player1MainCardImage7:SetDrawLayer("ARTWORK")

player1dealtCardsFrame.playerFirstCardText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.playerFirstCardText:SetPoint("LEFT", player1dealtCardsFrame, 23, -80)
player1dealtCardsFrame.playerFirstCardText:SetJustifyH("CENTER")
player1dealtCardsFrame.playerFirstCardText:SetText("1st Card")
player1dealtCardsFrame.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrame.playerFirstCardText:Hide()

player1dealtCardsFrame.playerSecondCardText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.playerSecondCardText:SetPoint("LEFT", player1dealtCardsFrame, 112, -80)
player1dealtCardsFrame.playerSecondCardText:SetJustifyH("CENTER")
player1dealtCardsFrame.playerSecondCardText:SetText("2nd Card")
player1dealtCardsFrame.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrame.playerSecondCardText:Hide()

player1dealtCardsFrame.playerThirdCardText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.playerThirdCardText:SetPoint("LEFT", player1dealtCardsFrame, 207, -80)
player1dealtCardsFrame.playerThirdCardText:SetJustifyH("CENTER")
player1dealtCardsFrame.playerThirdCardText:SetText("3rd Card")
player1dealtCardsFrame.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrame.playerThirdCardText:Hide()

player1dealtCardsFrame.playerFourthCardText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.playerFourthCardText:SetPoint("LEFT", player1dealtCardsFrame, 299, -80)
player1dealtCardsFrame.playerFourthCardText:SetJustifyH("CENTER")
player1dealtCardsFrame.playerFourthCardText:SetText("4th Card")
player1dealtCardsFrame.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrame.playerFourthCardText:Hide()

player1dealtCardsFrame.playerFifthCardText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.playerFifthCardText:SetPoint("LEFT", player1dealtCardsFrame, 392, -80)
player1dealtCardsFrame.playerFifthCardText:SetJustifyH("CENTER")
player1dealtCardsFrame.playerFifthCardText:SetText("5th Card")
player1dealtCardsFrame.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrame.playerFifthCardText:Hide()

player1dealtCardsFrame.playerSixthCardText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.playerSixthCardText:SetPoint("LEFT", player1dealtCardsFrame, 483, -80)
player1dealtCardsFrame.playerSixthCardText:SetJustifyH("CENTER")
player1dealtCardsFrame.playerSixthCardText:SetText("6th Card")
player1dealtCardsFrame.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrame.playerSixthCardText:Hide()

player1dealtCardsFrame.playerSeventhCardText = player1dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrame.playerSeventhCardText:SetPoint("LEFT", player1dealtCardsFrame, 576, -80)
player1dealtCardsFrame.playerSeventhCardText:SetJustifyH("CENTER")
player1dealtCardsFrame.playerSeventhCardText:SetText("7th Card")
player1dealtCardsFrame.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrame.playerSeventhCardText:Hide()

-- Player H1 Dealt Cards Frame
player1dealtCardsFrameSplitH1= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player1dealtCardsFrameSplitH1:SetSize(656, 200)
player1dealtCardsFrameSplitH1:SetPoint("BOTTOM", playerFrame, 0, 5)
player1dealtCardsFrameSplitH1:SetFrameStrata("HIGH")
player1dealtCardsFrameSplitH1:SetFrameLevel(5)
player1dealtCardsFrameSplitH1:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player1dealtCardsFrameSplitH1.playerH1CardsButton = CreateFrame("Button", nil, player1dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player1dealtCardsFrameSplitH1.playerH1CardsButton:SetPoint("TOPLEFT", player1dealtCardsFrameSplitH1, 8, -8)
player1dealtCardsFrameSplitH1.playerH1CardsButton:SetSize(75, 25)
player1dealtCardsFrameSplitH1.playerH1CardsButton:SetText("Hand 1")
player1dealtCardsFrameSplitH1.playerH1CardsButton:Disable()
player1dealtCardsFrameSplitH1.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player1dealtCardsFrameSplitH1.playerH2CardsButton = CreateFrame("Button", nil, player1dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player1dealtCardsFrameSplitH1.playerH2CardsButton:SetPoint("TOPLEFT", player1dealtCardsFrameSplitH1, 84, -8)
player1dealtCardsFrameSplitH1.playerH2CardsButton:SetSize(75, 25)
player1dealtCardsFrameSplitH1.playerH2CardsButton:SetText("Hand 2")
player1dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

player1dealtCardsFrameSplitH1.player1H1CardImage1 = player1dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH1.player1H1CardImage1:SetSize(85, 170)
player1dealtCardsFrameSplitH1.player1H1CardImage1:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 10, -7)
player1dealtCardsFrameSplitH1.player1H1CardImage1:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH1.player1H1CardImage1:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH1.player1H1CardImage2 = player1dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH1.player1H1CardImage2:SetSize(85, 170)
player1dealtCardsFrameSplitH1.player1H1CardImage2:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 102, -7)
player1dealtCardsFrameSplitH1.player1H1CardImage2:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH1.player1H1CardImage2:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH1.player1H1CardImage3 = player1dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH1.player1H1CardImage3:SetSize(85, 170)
player1dealtCardsFrameSplitH1.player1H1CardImage3:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 194, -7)
player1dealtCardsFrameSplitH1.player1H1CardImage3:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH1.player1H1CardImage3:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH1.player1H1CardImage4 = player1dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH1.player1H1CardImage4:SetSize(85, 170)
player1dealtCardsFrameSplitH1.player1H1CardImage4:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 286, -7)
player1dealtCardsFrameSplitH1.player1H1CardImage4:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH1.player1H1CardImage4:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH1.player1H1CardImage5 = player1dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH1.player1H1CardImage5:SetSize(85, 170)
player1dealtCardsFrameSplitH1.player1H1CardImage5:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 378, -7)
player1dealtCardsFrameSplitH1.player1H1CardImage5:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH1.player1H1CardImage5:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH1.player1H1CardImage6 = player1dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH1.player1H1CardImage6:SetSize(85, 170)
player1dealtCardsFrameSplitH1.player1H1CardImage6:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 470, -7)
player1dealtCardsFrameSplitH1.player1H1CardImage6:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH1.player1H1CardImage6:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH1.player1H1CardImage7 = player1dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH1.player1H1CardImage7:SetSize(85, 170)
player1dealtCardsFrameSplitH1.player1H1CardImage7:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 562, -7)
player1dealtCardsFrameSplitH1.player1H1CardImage7:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH1.player1H1CardImage7:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH1.playerFirstCardText = player1dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH1.playerFirstCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 23, -80)
player1dealtCardsFrameSplitH1.playerFirstCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH1.playerFirstCardText:SetText("1st Card")
player1dealtCardsFrameSplitH1.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH1.playerFirstCardText:Hide()

player1dealtCardsFrameSplitH1.playerSecondCardText = player1dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH1.playerSecondCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 112, -80)
player1dealtCardsFrameSplitH1.playerSecondCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH1.playerSecondCardText:SetText("2nd Card")
player1dealtCardsFrameSplitH1.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH1.playerSecondCardText:Hide()

player1dealtCardsFrameSplitH1.playerThirdCardText = player1dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH1.playerThirdCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 207, -80)
player1dealtCardsFrameSplitH1.playerThirdCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH1.playerThirdCardText:SetText("3rd Card")
player1dealtCardsFrameSplitH1.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH1.playerThirdCardText:Hide()

player1dealtCardsFrameSplitH1.playerFourthCardText = player1dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH1.playerFourthCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 299, -80)
player1dealtCardsFrameSplitH1.playerFourthCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH1.playerFourthCardText:SetText("4th Card")
player1dealtCardsFrameSplitH1.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH1.playerFourthCardText:Hide()

player1dealtCardsFrameSplitH1.playerFifthCardText = player1dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH1.playerFifthCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 392, -80)
player1dealtCardsFrameSplitH1.playerFifthCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH1.playerFifthCardText:SetText("5th Card")
player1dealtCardsFrameSplitH1.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH1.playerFifthCardText:Hide()

player1dealtCardsFrameSplitH1.playerSixthCardText = player1dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH1.playerSixthCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 483, -80)
player1dealtCardsFrameSplitH1.playerSixthCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH1.playerSixthCardText:SetText("6th Card")
player1dealtCardsFrameSplitH1.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH1.playerSixthCardText:Hide()

player1dealtCardsFrameSplitH1.playerSeventhCardText = player1dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH1.playerSeventhCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH1, 576, -80)
player1dealtCardsFrameSplitH1.playerSeventhCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH1.playerSeventhCardText:SetText("7th Card")
player1dealtCardsFrameSplitH1.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

-- Player H2 Dealt Cards Frame
player1dealtCardsFrameSplitH2= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player1dealtCardsFrameSplitH2:SetSize(656, 200)
player1dealtCardsFrameSplitH2:SetPoint("BOTTOM", playerFrame, 0, 5)
player1dealtCardsFrameSplitH2:SetFrameStrata("HIGH")
player1dealtCardsFrameSplitH2:SetFrameLevel(5)
player1dealtCardsFrameSplitH2:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player1dealtCardsFrameSplitH2.playerH1CardsButton = CreateFrame("Button", nil, player1dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player1dealtCardsFrameSplitH2.playerH1CardsButton:SetPoint("TOPLEFT", player1dealtCardsFrameSplitH2, 8, -8)
player1dealtCardsFrameSplitH2.playerH1CardsButton:SetSize(75, 25)
player1dealtCardsFrameSplitH2.playerH1CardsButton:SetText("Hand 1")
player1dealtCardsFrameSplitH2.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player1dealtCardsFrameSplitH2.playerH2CardsButton = CreateFrame("Button", nil, player1dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player1dealtCardsFrameSplitH2.playerH2CardsButton:SetPoint("TOPLEFT", player1dealtCardsFrameSplitH2, 84, -8)
player1dealtCardsFrameSplitH2.playerH2CardsButton:SetSize(75, 25)
player1dealtCardsFrameSplitH2.playerH2CardsButton:SetText("Hand 2")
player1dealtCardsFrameSplitH2.playerH2CardsButton:Disable()
player1dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

player1dealtCardsFrameSplitH2.player1H2CardImage1 = player1dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH2.player1H2CardImage1:SetSize(85, 170)
player1dealtCardsFrameSplitH2.player1H2CardImage1:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 10, -7)
player1dealtCardsFrameSplitH2.player1H2CardImage1:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH2.player1H2CardImage1:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH2.player1H2CardImage2 = player1dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH2.player1H2CardImage2:SetSize(85, 170)
player1dealtCardsFrameSplitH2.player1H2CardImage2:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 102, -7)
player1dealtCardsFrameSplitH2.player1H2CardImage2:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH2.player1H2CardImage2:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH2.player1H2CardImage3 = player1dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH2.player1H2CardImage3:SetSize(85, 170)
player1dealtCardsFrameSplitH2.player1H2CardImage3:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 194, -7)
player1dealtCardsFrameSplitH2.player1H2CardImage3:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH2.player1H2CardImage3:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH2.player1H2CardImage4 = player1dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH2.player1H2CardImage4:SetSize(85, 170)
player1dealtCardsFrameSplitH2.player1H2CardImage4:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 286, -7)
player1dealtCardsFrameSplitH2.player1H2CardImage4:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH2.player1H2CardImage4:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH2.player1H2CardImage5 = player1dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH2.player1H2CardImage5:SetSize(85, 170)
player1dealtCardsFrameSplitH2.player1H2CardImage5:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 378, -7)
player1dealtCardsFrameSplitH2.player1H2CardImage5:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH2.player1H2CardImage5:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH2.player1H2CardImage6 = player1dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH2.player1H2CardImage6:SetSize(85, 170)
player1dealtCardsFrameSplitH2.player1H2CardImage6:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 470, -7)
player1dealtCardsFrameSplitH2.player1H2CardImage6:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH2.player1H2CardImage6:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH2.player1H2CardImage7 = player1dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player1dealtCardsFrameSplitH2.player1H2CardImage7:SetSize(85, 170)
player1dealtCardsFrameSplitH2.player1H2CardImage7:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 562, -7)
player1dealtCardsFrameSplitH2.player1H2CardImage7:SetBlendMode("BLEND")
player1dealtCardsFrameSplitH2.player1H2CardImage7:SetDrawLayer("ARTWORK")

player1dealtCardsFrameSplitH2.playerFirstCardText = player1dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH2.playerFirstCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 23, -80)
player1dealtCardsFrameSplitH2.playerFirstCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH2.playerFirstCardText:SetText("1st Card")
player1dealtCardsFrameSplitH2.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH2.playerFirstCardText:Hide()

player1dealtCardsFrameSplitH2.playerSecondCardText = player1dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH2.playerSecondCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 112, -80)
player1dealtCardsFrameSplitH2.playerSecondCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH2.playerSecondCardText:SetText("2nd Card")
player1dealtCardsFrameSplitH2.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH2.playerSecondCardText:Hide()

player1dealtCardsFrameSplitH2.playerThirdCardText = player1dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH2.playerThirdCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 207, -80)
player1dealtCardsFrameSplitH2.playerThirdCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH2.playerThirdCardText:SetText("3rd Card")
player1dealtCardsFrameSplitH2.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH2.playerThirdCardText:Hide()

player1dealtCardsFrameSplitH2.playerFourthCardText = player1dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH2.playerFourthCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 299, -80)
player1dealtCardsFrameSplitH2.playerFourthCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH2.playerFourthCardText:SetText("4th Card")
player1dealtCardsFrameSplitH2.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH2.playerFourthCardText:Hide()

player1dealtCardsFrameSplitH2.playerFifthCardText = player1dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH2.playerFifthCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 392, -80)
player1dealtCardsFrameSplitH2.playerFifthCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH2.playerFifthCardText:SetText("5th Card")
player1dealtCardsFrameSplitH2.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH2.playerFifthCardText:Hide()

player1dealtCardsFrameSplitH2.playerSixthCardText = player1dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH2.playerSixthCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 483, -80)
player1dealtCardsFrameSplitH2.playerSixthCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH2.playerSixthCardText:SetText("6th Card")
player1dealtCardsFrameSplitH2.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH2.playerSixthCardText:Hide()

player1dealtCardsFrameSplitH2.playerSeventhCardText = player1dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1dealtCardsFrameSplitH2.playerSeventhCardText:SetPoint("LEFT", player1dealtCardsFrameSplitH2, 576, -80)
player1dealtCardsFrameSplitH2.playerSeventhCardText:SetJustifyH("CENTER")
player1dealtCardsFrameSplitH2.playerSeventhCardText:SetText("7th Card")
player1dealtCardsFrameSplitH2.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player1dealtCardsFrameSplitH2.playerSeventhCardText:Hide()







-- >> PLAYER 2 <<
-- >> PLAYER 2 <<
-- >> PLAYER 2 <<

-- Player Dealt Cards Frame
player2dealtCardsFrame= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player2dealtCardsFrame:SetSize(656, 200)
player2dealtCardsFrame:SetPoint("BOTTOM", playerFrame, 0, 5)
player2dealtCardsFrame:SetFrameStrata("HIGH")
player2dealtCardsFrame:SetFrameLevel(6)
player2dealtCardsFrame:Hide()

-- "Player" button which displays Player's Main Hand cards
player2dealtCardsFrame.playerCardsButton = CreateFrame("Button", nil, player2dealtCardsFrame, "GameMenuButtonTemplate")
player2dealtCardsFrame.playerCardsButton:SetPoint("TOPLEFT", player2dealtCardsFrame, 8, -8)
player2dealtCardsFrame.playerCardsButton:SetSize(75, 25)
player2dealtCardsFrame.playerCardsButton:SetText("Player")
player2dealtCardsFrame.playerCardsButton:Disable()
player2dealtCardsFrame.playerCardsButton:Hide()

player2dealtCardsFrame.notStartedYetText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.notStartedYetText:SetPoint("CENTER", player2dealtCardsFrame, 0, 0)
player2dealtCardsFrame.notStartedYetText:SetJustifyH("CENTER")
player2dealtCardsFrame.notStartedYetText:SetText("The round hasn't started yet")
player2dealtCardsFrame.notStartedYetText:SetFont("Fonts\\FRIZQT__.TTF", 20, "OUTLINE")
player2dealtCardsFrame.notStartedYetText:Hide()

player2dealtCardsFrame.player2MainCardImage1 = player2dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrame.player2MainCardImage1:SetSize(85, 170)
player2dealtCardsFrame.player2MainCardImage1:SetPoint("LEFT", player2dealtCardsFrame, 10, -7)
player2dealtCardsFrame.player2MainCardImage1:SetBlendMode("BLEND")
player2dealtCardsFrame.player2MainCardImage1:SetDrawLayer("ARTWORK")

player2dealtCardsFrame.player2MainCardImage2 = player2dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrame.player2MainCardImage2:SetSize(85, 170)
player2dealtCardsFrame.player2MainCardImage2:SetPoint("LEFT", player2dealtCardsFrame, 102, -7)
player2dealtCardsFrame.player2MainCardImage2:SetBlendMode("BLEND")
player2dealtCardsFrame.player2MainCardImage2:SetDrawLayer("ARTWORK")

player2dealtCardsFrame.player2MainCardImage3 = player2dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrame.player2MainCardImage3:SetSize(85, 170)
player2dealtCardsFrame.player2MainCardImage3:SetPoint("LEFT", player2dealtCardsFrame, 194, -7)
player2dealtCardsFrame.player2MainCardImage3:SetBlendMode("BLEND")
player2dealtCardsFrame.player2MainCardImage3:SetDrawLayer("ARTWORK")

player2dealtCardsFrame.player2MainCardImage4 = player2dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrame.player2MainCardImage4:SetSize(85, 170)
player2dealtCardsFrame.player2MainCardImage4:SetPoint("LEFT", player2dealtCardsFrame, 286, -7)
player2dealtCardsFrame.player2MainCardImage4:SetBlendMode("BLEND")
player2dealtCardsFrame.player2MainCardImage4:SetDrawLayer("ARTWORK")

player2dealtCardsFrame.player2MainCardImage5 = player2dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrame.player2MainCardImage5:SetSize(85, 170)
player2dealtCardsFrame.player2MainCardImage5:SetPoint("LEFT", player2dealtCardsFrame, 378, -7)
player2dealtCardsFrame.player2MainCardImage5:SetBlendMode("BLEND")
player2dealtCardsFrame.player2MainCardImage5:SetDrawLayer("ARTWORK")

player2dealtCardsFrame.player2MainCardImage6 = player2dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrame.player2MainCardImage6:SetSize(85, 170)
player2dealtCardsFrame.player2MainCardImage6:SetPoint("LEFT", player2dealtCardsFrame, 470, -7)
player2dealtCardsFrame.player2MainCardImage6:SetBlendMode("BLEND")
player2dealtCardsFrame.player2MainCardImage6:SetDrawLayer("ARTWORK")

player2dealtCardsFrame.player2MainCardImage7 = player2dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrame.player2MainCardImage7:SetSize(85, 170)
player2dealtCardsFrame.player2MainCardImage7:SetPoint("LEFT", player2dealtCardsFrame, 562, -7)
player2dealtCardsFrame.player2MainCardImage7:SetBlendMode("BLEND")
player2dealtCardsFrame.player2MainCardImage7:SetDrawLayer("ARTWORK")

player2dealtCardsFrame.playerFirstCardText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.playerFirstCardText:SetPoint("LEFT", player2dealtCardsFrame, 23, -80)
player2dealtCardsFrame.playerFirstCardText:SetJustifyH("CENTER")
player2dealtCardsFrame.playerFirstCardText:SetText("1st Card")
player2dealtCardsFrame.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrame.playerFirstCardText:Hide()

player2dealtCardsFrame.playerSecondCardText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.playerSecondCardText:SetPoint("LEFT", player2dealtCardsFrame, 112, -80)
player2dealtCardsFrame.playerSecondCardText:SetJustifyH("CENTER")
player2dealtCardsFrame.playerSecondCardText:SetText("2nd Card")
player2dealtCardsFrame.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrame.playerSecondCardText:Hide()

player2dealtCardsFrame.playerThirdCardText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.playerThirdCardText:SetPoint("LEFT", player2dealtCardsFrame, 207, -80)
player2dealtCardsFrame.playerThirdCardText:SetJustifyH("CENTER")
player2dealtCardsFrame.playerThirdCardText:SetText("3rd Card")
player2dealtCardsFrame.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrame.playerThirdCardText:Hide()

player2dealtCardsFrame.playerFourthCardText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.playerFourthCardText:SetPoint("LEFT", player2dealtCardsFrame, 299, -80)
player2dealtCardsFrame.playerFourthCardText:SetJustifyH("CENTER")
player2dealtCardsFrame.playerFourthCardText:SetText("4th Card")
player2dealtCardsFrame.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrame.playerFourthCardText:Hide()

player2dealtCardsFrame.playerFifthCardText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.playerFifthCardText:SetPoint("LEFT", player2dealtCardsFrame, 392, -80)
player2dealtCardsFrame.playerFifthCardText:SetJustifyH("CENTER")
player2dealtCardsFrame.playerFifthCardText:SetText("5th Card")
player2dealtCardsFrame.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrame.playerFifthCardText:Hide()

player2dealtCardsFrame.playerSixthCardText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.playerSixthCardText:SetPoint("LEFT", player2dealtCardsFrame, 483, -80)
player2dealtCardsFrame.playerSixthCardText:SetJustifyH("CENTER")
player2dealtCardsFrame.playerSixthCardText:SetText("6th Card")
player2dealtCardsFrame.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrame.playerSixthCardText:Hide()

player2dealtCardsFrame.playerSeventhCardText = player2dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrame.playerSeventhCardText:SetPoint("LEFT", player2dealtCardsFrame, 576, -80)
player2dealtCardsFrame.playerSeventhCardText:SetJustifyH("CENTER")
player2dealtCardsFrame.playerSeventhCardText:SetText("7th Card")
player2dealtCardsFrame.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrame.playerSeventhCardText:Hide()

-- Player H1 Dealt Cards Frame
player2dealtCardsFrameSplitH1= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player2dealtCardsFrameSplitH1:SetSize(656, 200)
player2dealtCardsFrameSplitH1:SetPoint("BOTTOM", playerFrame, 0, 5)
player2dealtCardsFrameSplitH1:SetFrameStrata("HIGH")
player2dealtCardsFrameSplitH1:SetFrameLevel(5)
player2dealtCardsFrameSplitH1:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player2dealtCardsFrameSplitH1.playerH1CardsButton = CreateFrame("Button", nil, player2dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player2dealtCardsFrameSplitH1.playerH1CardsButton:SetPoint("TOPLEFT", player2dealtCardsFrameSplitH1, 8, -8)
player2dealtCardsFrameSplitH1.playerH1CardsButton:SetSize(75, 25)
player2dealtCardsFrameSplitH1.playerH1CardsButton:SetText("Hand 1")
player2dealtCardsFrameSplitH1.playerH1CardsButton:Disable()
player2dealtCardsFrameSplitH1.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player2dealtCardsFrameSplitH1.playerH2CardsButton = CreateFrame("Button", nil, player2dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player2dealtCardsFrameSplitH1.playerH2CardsButton:SetPoint("TOPLEFT", player2dealtCardsFrameSplitH1, 84, -8)
player2dealtCardsFrameSplitH1.playerH2CardsButton:SetSize(75, 25)
player2dealtCardsFrameSplitH1.playerH2CardsButton:SetText("Hand 2")
player2dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

player2dealtCardsFrameSplitH1.player2H1CardImage1 = player2dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH1.player2H1CardImage1:SetSize(85, 170)
player2dealtCardsFrameSplitH1.player2H1CardImage1:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 10, -7)
player2dealtCardsFrameSplitH1.player2H1CardImage1:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH1.player2H1CardImage1:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH1.player2H1CardImage2 = player2dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH1.player2H1CardImage2:SetSize(85, 170)
player2dealtCardsFrameSplitH1.player2H1CardImage2:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 102, -7)
player2dealtCardsFrameSplitH1.player2H1CardImage2:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH1.player2H1CardImage2:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH1.player2H1CardImage3 = player2dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH1.player2H1CardImage3:SetSize(85, 170)
player2dealtCardsFrameSplitH1.player2H1CardImage3:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 194, -7)
player2dealtCardsFrameSplitH1.player2H1CardImage3:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH1.player2H1CardImage3:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH1.player2H1CardImage4 = player2dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH1.player2H1CardImage4:SetSize(85, 170)
player2dealtCardsFrameSplitH1.player2H1CardImage4:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 286, -7)
player2dealtCardsFrameSplitH1.player2H1CardImage4:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH1.player2H1CardImage4:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH1.player2H1CardImage5 = player2dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH1.player2H1CardImage5:SetSize(85, 170)
player2dealtCardsFrameSplitH1.player2H1CardImage5:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 378, -7)
player2dealtCardsFrameSplitH1.player2H1CardImage5:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH1.player2H1CardImage5:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH1.player2H1CardImage6 = player2dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH1.player2H1CardImage6:SetSize(85, 170)
player2dealtCardsFrameSplitH1.player2H1CardImage6:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 470, -7)
player2dealtCardsFrameSplitH1.player2H1CardImage6:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH1.player2H1CardImage6:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH1.player2H1CardImage7 = player2dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH1.player2H1CardImage7:SetSize(85, 170)
player2dealtCardsFrameSplitH1.player2H1CardImage7:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 562, -7)
player2dealtCardsFrameSplitH1.player2H1CardImage7:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH1.player2H1CardImage7:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH1.playerFirstCardText = player2dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH1.playerFirstCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 23, -80)
player2dealtCardsFrameSplitH1.playerFirstCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH1.playerFirstCardText:SetText("1st Card")
player2dealtCardsFrameSplitH1.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH1.playerFirstCardText:Hide()

player2dealtCardsFrameSplitH1.playerSecondCardText = player2dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH1.playerSecondCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 112, -80)
player2dealtCardsFrameSplitH1.playerSecondCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH1.playerSecondCardText:SetText("2nd Card")
player2dealtCardsFrameSplitH1.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH1.playerSecondCardText:Hide()

player2dealtCardsFrameSplitH1.playerThirdCardText = player2dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH1.playerThirdCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 207, -80)
player2dealtCardsFrameSplitH1.playerThirdCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH1.playerThirdCardText:SetText("3rd Card")
player2dealtCardsFrameSplitH1.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH1.playerThirdCardText:Hide()

player2dealtCardsFrameSplitH1.playerFourthCardText = player2dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH1.playerFourthCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 299, -80)
player2dealtCardsFrameSplitH1.playerFourthCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH1.playerFourthCardText:SetText("4th Card")
player2dealtCardsFrameSplitH1.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH1.playerFourthCardText:Hide()

player2dealtCardsFrameSplitH1.playerFifthCardText = player2dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH1.playerFifthCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 392, -80)
player2dealtCardsFrameSplitH1.playerFifthCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH1.playerFifthCardText:SetText("5th Card")
player2dealtCardsFrameSplitH1.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH1.playerFifthCardText:Hide()

player2dealtCardsFrameSplitH1.playerSixthCardText = player2dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH1.playerSixthCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 483, -80)
player2dealtCardsFrameSplitH1.playerSixthCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH1.playerSixthCardText:SetText("6th Card")
player2dealtCardsFrameSplitH1.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH1.playerSixthCardText:Hide()

player2dealtCardsFrameSplitH1.playerSeventhCardText = player2dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH1.playerSeventhCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH1, 576, -80)
player2dealtCardsFrameSplitH1.playerSeventhCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH1.playerSeventhCardText:SetText("7th Card")
player2dealtCardsFrameSplitH1.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

-- Player H2 Dealt Cards Frame
player2dealtCardsFrameSplitH2= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player2dealtCardsFrameSplitH2:SetSize(656, 200)
player2dealtCardsFrameSplitH2:SetPoint("BOTTOM", playerFrame, 0, 5)
player2dealtCardsFrameSplitH2:SetFrameStrata("HIGH")
player2dealtCardsFrameSplitH2:SetFrameLevel(5)
player2dealtCardsFrameSplitH2:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player2dealtCardsFrameSplitH2.playerH1CardsButton = CreateFrame("Button", nil, player2dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player2dealtCardsFrameSplitH2.playerH1CardsButton:SetPoint("TOPLEFT", player2dealtCardsFrameSplitH2, 8, -8)
player2dealtCardsFrameSplitH2.playerH1CardsButton:SetSize(75, 25)
player2dealtCardsFrameSplitH2.playerH1CardsButton:SetText("Hand 1")
player2dealtCardsFrameSplitH2.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player2dealtCardsFrameSplitH2.playerH2CardsButton = CreateFrame("Button", nil, player2dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player2dealtCardsFrameSplitH2.playerH2CardsButton:SetPoint("TOPLEFT", player2dealtCardsFrameSplitH2, 84, -8)
player2dealtCardsFrameSplitH2.playerH2CardsButton:SetSize(75, 25)
player2dealtCardsFrameSplitH2.playerH2CardsButton:SetText("Hand 2")
player2dealtCardsFrameSplitH2.playerH2CardsButton:Disable()
player2dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

player2dealtCardsFrameSplitH2.player2H2CardImage1 = player2dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH2.player2H2CardImage1:SetSize(85, 170)
player2dealtCardsFrameSplitH2.player2H2CardImage1:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 10, -7)
player2dealtCardsFrameSplitH2.player2H2CardImage1:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH2.player2H2CardImage1:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH2.player2H2CardImage2 = player2dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH2.player2H2CardImage2:SetSize(85, 170)
player2dealtCardsFrameSplitH2.player2H2CardImage2:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 102, -7)
player2dealtCardsFrameSplitH2.player2H2CardImage2:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH2.player2H2CardImage2:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH2.player2H2CardImage3 = player2dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH2.player2H2CardImage3:SetSize(85, 170)
player2dealtCardsFrameSplitH2.player2H2CardImage3:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 194, -7)
player2dealtCardsFrameSplitH2.player2H2CardImage3:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH2.player2H2CardImage3:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH2.player2H2CardImage4 = player2dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH2.player2H2CardImage4:SetSize(85, 170)
player2dealtCardsFrameSplitH2.player2H2CardImage4:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 286, -7)
player2dealtCardsFrameSplitH2.player2H2CardImage4:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH2.player2H2CardImage4:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH2.player2H2CardImage5 = player2dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH2.player2H2CardImage5:SetSize(85, 170)
player2dealtCardsFrameSplitH2.player2H2CardImage5:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 378, -7)
player2dealtCardsFrameSplitH2.player2H2CardImage5:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH2.player2H2CardImage5:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH2.player2H2CardImage6 = player2dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH2.player2H2CardImage6:SetSize(85, 170)
player2dealtCardsFrameSplitH2.player2H2CardImage6:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 470, -7)
player2dealtCardsFrameSplitH2.player2H2CardImage6:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH2.player2H2CardImage6:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH2.player2H2CardImage7 = player2dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player2dealtCardsFrameSplitH2.player2H2CardImage7:SetSize(85, 170)
player2dealtCardsFrameSplitH2.player2H2CardImage7:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 562, -7)
player2dealtCardsFrameSplitH2.player2H2CardImage7:SetBlendMode("BLEND")
player2dealtCardsFrameSplitH2.player2H2CardImage7:SetDrawLayer("ARTWORK")

player2dealtCardsFrameSplitH2.playerFirstCardText = player2dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH2.playerFirstCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 23, -80)
player2dealtCardsFrameSplitH2.playerFirstCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH2.playerFirstCardText:SetText("1st Card")
player2dealtCardsFrameSplitH2.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH2.playerFirstCardText:Hide()

player2dealtCardsFrameSplitH2.playerSecondCardText = player2dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH2.playerSecondCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 112, -80)
player2dealtCardsFrameSplitH2.playerSecondCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH2.playerSecondCardText:SetText("2nd Card")
player2dealtCardsFrameSplitH2.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH2.playerSecondCardText:Hide()

player2dealtCardsFrameSplitH2.playerThirdCardText = player2dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH2.playerThirdCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 207, -80)
player2dealtCardsFrameSplitH2.playerThirdCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH2.playerThirdCardText:SetText("3rd Card")
player2dealtCardsFrameSplitH2.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH2.playerThirdCardText:Hide()

player2dealtCardsFrameSplitH2.playerFourthCardText = player2dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH2.playerFourthCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 299, -80)
player2dealtCardsFrameSplitH2.playerFourthCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH2.playerFourthCardText:SetText("4th Card")
player2dealtCardsFrameSplitH2.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH2.playerFourthCardText:Hide()

player2dealtCardsFrameSplitH2.playerFifthCardText = player2dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH2.playerFifthCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 392, -80)
player2dealtCardsFrameSplitH2.playerFifthCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH2.playerFifthCardText:SetText("5th Card")
player2dealtCardsFrameSplitH2.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH2.playerFifthCardText:Hide()

player2dealtCardsFrameSplitH2.playerSixthCardText = player2dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH2.playerSixthCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 483, -80)
player2dealtCardsFrameSplitH2.playerSixthCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH2.playerSixthCardText:SetText("6th Card")
player2dealtCardsFrameSplitH2.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH2.playerSixthCardText:Hide()

player2dealtCardsFrameSplitH2.playerSeventhCardText = player2dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2dealtCardsFrameSplitH2.playerSeventhCardText:SetPoint("LEFT", player2dealtCardsFrameSplitH2, 576, -80)
player2dealtCardsFrameSplitH2.playerSeventhCardText:SetJustifyH("CENTER")
player2dealtCardsFrameSplitH2.playerSeventhCardText:SetText("7th Card")
player2dealtCardsFrameSplitH2.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player2dealtCardsFrameSplitH2.playerSeventhCardText:Hide()







-- >> PLAYER 3 <<
-- >> PLAYER 3 <<
-- >> PLAYER 3 <<

-- Player Dealt Cards Frame
player3dealtCardsFrame= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player3dealtCardsFrame:SetSize(656, 200)
player3dealtCardsFrame:SetPoint("BOTTOM", playerFrame, 0, 5)
player3dealtCardsFrame:SetFrameStrata("HIGH")
player3dealtCardsFrame:SetFrameLevel(6)
player3dealtCardsFrame:Hide()

-- "Player" button which displays Player's Main Hand cards
player3dealtCardsFrame.playerCardsButton = CreateFrame("Button", nil, player3dealtCardsFrame, "GameMenuButtonTemplate")
player3dealtCardsFrame.playerCardsButton:SetPoint("TOPLEFT", player3dealtCardsFrame, 8, -8)
player3dealtCardsFrame.playerCardsButton:SetSize(75, 25)
player3dealtCardsFrame.playerCardsButton:SetText("Player")
player3dealtCardsFrame.playerCardsButton:Disable()
player3dealtCardsFrame.playerCardsButton:Hide()

player3dealtCardsFrame.notStartedYetText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.notStartedYetText:SetPoint("CENTER", player3dealtCardsFrame, 0, 0)
player3dealtCardsFrame.notStartedYetText:SetJustifyH("CENTER")
player3dealtCardsFrame.notStartedYetText:SetText("The round hasn't started yet")
player3dealtCardsFrame.notStartedYetText:SetFont("Fonts\\FRIZQT__.TTF", 20, "OUTLINE")
player3dealtCardsFrame.notStartedYetText:Hide()

player3dealtCardsFrame.player3MainCardImage1 = player3dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrame.player3MainCardImage1:SetSize(85, 170)
player3dealtCardsFrame.player3MainCardImage1:SetPoint("LEFT", player3dealtCardsFrame, 10, -7)
player3dealtCardsFrame.player3MainCardImage1:SetBlendMode("BLEND")
player3dealtCardsFrame.player3MainCardImage1:SetDrawLayer("ARTWORK")

player3dealtCardsFrame.player3MainCardImage2 = player3dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrame.player3MainCardImage2:SetSize(85, 170)
player3dealtCardsFrame.player3MainCardImage2:SetPoint("LEFT", player3dealtCardsFrame, 102, -7)
player3dealtCardsFrame.player3MainCardImage2:SetBlendMode("BLEND")
player3dealtCardsFrame.player3MainCardImage2:SetDrawLayer("ARTWORK")

player3dealtCardsFrame.player3MainCardImage3 = player3dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrame.player3MainCardImage3:SetSize(85, 170)
player3dealtCardsFrame.player3MainCardImage3:SetPoint("LEFT", player3dealtCardsFrame, 194, -7)
player3dealtCardsFrame.player3MainCardImage3:SetBlendMode("BLEND")
player3dealtCardsFrame.player3MainCardImage3:SetDrawLayer("ARTWORK")

player3dealtCardsFrame.player3MainCardImage4 = player3dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrame.player3MainCardImage4:SetSize(85, 170)
player3dealtCardsFrame.player3MainCardImage4:SetPoint("LEFT", player3dealtCardsFrame, 286, -7)
player3dealtCardsFrame.player3MainCardImage4:SetBlendMode("BLEND")
player3dealtCardsFrame.player3MainCardImage4:SetDrawLayer("ARTWORK")

player3dealtCardsFrame.player3MainCardImage5 = player3dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrame.player3MainCardImage5:SetSize(85, 170)
player3dealtCardsFrame.player3MainCardImage5:SetPoint("LEFT", player3dealtCardsFrame, 378, -7)
player3dealtCardsFrame.player3MainCardImage5:SetBlendMode("BLEND")
player3dealtCardsFrame.player3MainCardImage5:SetDrawLayer("ARTWORK")

player3dealtCardsFrame.player3MainCardImage6 = player3dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrame.player3MainCardImage6:SetSize(85, 170)
player3dealtCardsFrame.player3MainCardImage6:SetPoint("LEFT", player3dealtCardsFrame, 470, -7)
player3dealtCardsFrame.player3MainCardImage6:SetBlendMode("BLEND")
player3dealtCardsFrame.player3MainCardImage6:SetDrawLayer("ARTWORK")

player3dealtCardsFrame.player3MainCardImage7 = player3dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrame.player3MainCardImage7:SetSize(85, 170)
player3dealtCardsFrame.player3MainCardImage7:SetPoint("LEFT", player3dealtCardsFrame, 562, -7)
player3dealtCardsFrame.player3MainCardImage7:SetBlendMode("BLEND")
player3dealtCardsFrame.player3MainCardImage7:SetDrawLayer("ARTWORK")

player3dealtCardsFrame.playerFirstCardText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.playerFirstCardText:SetPoint("LEFT", player3dealtCardsFrame, 23, -80)
player3dealtCardsFrame.playerFirstCardText:SetJustifyH("CENTER")
player3dealtCardsFrame.playerFirstCardText:SetText("1st Card")
player3dealtCardsFrame.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrame.playerFirstCardText:Hide()

player3dealtCardsFrame.playerSecondCardText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.playerSecondCardText:SetPoint("LEFT", player3dealtCardsFrame, 112, -80)
player3dealtCardsFrame.playerSecondCardText:SetJustifyH("CENTER")
player3dealtCardsFrame.playerSecondCardText:SetText("2nd Card")
player3dealtCardsFrame.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrame.playerSecondCardText:Hide()

player3dealtCardsFrame.playerThirdCardText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.playerThirdCardText:SetPoint("LEFT", player3dealtCardsFrame, 207, -80)
player3dealtCardsFrame.playerThirdCardText:SetJustifyH("CENTER")
player3dealtCardsFrame.playerThirdCardText:SetText("3rd Card")
player3dealtCardsFrame.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrame.playerThirdCardText:Hide()

player3dealtCardsFrame.playerFourthCardText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.playerFourthCardText:SetPoint("LEFT", player3dealtCardsFrame, 299, -80)
player3dealtCardsFrame.playerFourthCardText:SetJustifyH("CENTER")
player3dealtCardsFrame.playerFourthCardText:SetText("4th Card")
player3dealtCardsFrame.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrame.playerFourthCardText:Hide()

player3dealtCardsFrame.playerFifthCardText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.playerFifthCardText:SetPoint("LEFT", player3dealtCardsFrame, 392, -80)
player3dealtCardsFrame.playerFifthCardText:SetJustifyH("CENTER")
player3dealtCardsFrame.playerFifthCardText:SetText("5th Card")
player3dealtCardsFrame.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrame.playerFifthCardText:Hide()

player3dealtCardsFrame.playerSixthCardText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.playerSixthCardText:SetPoint("LEFT", player3dealtCardsFrame, 483, -80)
player3dealtCardsFrame.playerSixthCardText:SetJustifyH("CENTER")
player3dealtCardsFrame.playerSixthCardText:SetText("6th Card")
player3dealtCardsFrame.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrame.playerSixthCardText:Hide()

player3dealtCardsFrame.playerSeventhCardText = player3dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrame.playerSeventhCardText:SetPoint("LEFT", player3dealtCardsFrame, 576, -80)
player3dealtCardsFrame.playerSeventhCardText:SetJustifyH("CENTER")
player3dealtCardsFrame.playerSeventhCardText:SetText("7th Card")
player3dealtCardsFrame.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrame.playerSeventhCardText:Hide()

-- Player H1 Dealt Cards Frame
player3dealtCardsFrameSplitH1= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player3dealtCardsFrameSplitH1:SetSize(656, 200)
player3dealtCardsFrameSplitH1:SetPoint("BOTTOM", playerFrame, 0, 5)
player3dealtCardsFrameSplitH1:SetFrameStrata("HIGH")
player3dealtCardsFrameSplitH1:SetFrameLevel(5)
player3dealtCardsFrameSplitH1:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player3dealtCardsFrameSplitH1.playerH1CardsButton = CreateFrame("Button", nil, player3dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player3dealtCardsFrameSplitH1.playerH1CardsButton:SetPoint("TOPLEFT", player3dealtCardsFrameSplitH1, 8, -8)
player3dealtCardsFrameSplitH1.playerH1CardsButton:SetSize(75, 25)
player3dealtCardsFrameSplitH1.playerH1CardsButton:SetText("Hand 1")
player3dealtCardsFrameSplitH1.playerH1CardsButton:Disable()
player3dealtCardsFrameSplitH1.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player3dealtCardsFrameSplitH1.playerH2CardsButton = CreateFrame("Button", nil, player3dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player3dealtCardsFrameSplitH1.playerH2CardsButton:SetPoint("TOPLEFT", player3dealtCardsFrameSplitH1, 84, -8)
player3dealtCardsFrameSplitH1.playerH2CardsButton:SetSize(75, 25)
player3dealtCardsFrameSplitH1.playerH2CardsButton:SetText("Hand 2")
player3dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

player3dealtCardsFrameSplitH1.player3H1CardImage1 = player3dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH1.player3H1CardImage1:SetSize(85, 170)
player3dealtCardsFrameSplitH1.player3H1CardImage1:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 10, -7)
player3dealtCardsFrameSplitH1.player3H1CardImage1:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH1.player3H1CardImage1:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH1.player3H1CardImage2 = player3dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH1.player3H1CardImage2:SetSize(85, 170)
player3dealtCardsFrameSplitH1.player3H1CardImage2:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 102, -7)
player3dealtCardsFrameSplitH1.player3H1CardImage2:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH1.player3H1CardImage2:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH1.player3H1CardImage3 = player3dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH1.player3H1CardImage3:SetSize(85, 170)
player3dealtCardsFrameSplitH1.player3H1CardImage3:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 194, -7)
player3dealtCardsFrameSplitH1.player3H1CardImage3:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH1.player3H1CardImage3:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH1.player3H1CardImage4 = player3dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH1.player3H1CardImage4:SetSize(85, 170)
player3dealtCardsFrameSplitH1.player3H1CardImage4:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 286, -7)
player3dealtCardsFrameSplitH1.player3H1CardImage4:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH1.player3H1CardImage4:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH1.player3H1CardImage5 = player3dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH1.player3H1CardImage5:SetSize(85, 170)
player3dealtCardsFrameSplitH1.player3H1CardImage5:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 378, -7)
player3dealtCardsFrameSplitH1.player3H1CardImage5:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH1.player3H1CardImage5:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH1.player3H1CardImage6 = player3dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH1.player3H1CardImage6:SetSize(85, 170)
player3dealtCardsFrameSplitH1.player3H1CardImage6:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 470, -7)
player3dealtCardsFrameSplitH1.player3H1CardImage6:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH1.player3H1CardImage6:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH1.player3H1CardImage7 = player3dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH1.player3H1CardImage7:SetSize(85, 170)
player3dealtCardsFrameSplitH1.player3H1CardImage7:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 562, -7)
player3dealtCardsFrameSplitH1.player3H1CardImage7:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH1.player3H1CardImage7:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH1.playerFirstCardText = player3dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH1.playerFirstCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 23, -80)
player3dealtCardsFrameSplitH1.playerFirstCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH1.playerFirstCardText:SetText("1st Card")
player3dealtCardsFrameSplitH1.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH1.playerFirstCardText:Hide()

player3dealtCardsFrameSplitH1.playerSecondCardText = player3dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH1.playerSecondCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 112, -80)
player3dealtCardsFrameSplitH1.playerSecondCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH1.playerSecondCardText:SetText("2nd Card")
player3dealtCardsFrameSplitH1.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH1.playerSecondCardText:Hide()

player3dealtCardsFrameSplitH1.playerThirdCardText = player3dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH1.playerThirdCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 207, -80)
player3dealtCardsFrameSplitH1.playerThirdCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH1.playerThirdCardText:SetText("3rd Card")
player3dealtCardsFrameSplitH1.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH1.playerThirdCardText:Hide()

player3dealtCardsFrameSplitH1.playerFourthCardText = player3dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH1.playerFourthCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 299, -80)
player3dealtCardsFrameSplitH1.playerFourthCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH1.playerFourthCardText:SetText("4th Card")
player3dealtCardsFrameSplitH1.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH1.playerFourthCardText:Hide()

player3dealtCardsFrameSplitH1.playerFifthCardText = player3dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH1.playerFifthCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 392, -80)
player3dealtCardsFrameSplitH1.playerFifthCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH1.playerFifthCardText:SetText("5th Card")
player3dealtCardsFrameSplitH1.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH1.playerFifthCardText:Hide()

player3dealtCardsFrameSplitH1.playerSixthCardText = player3dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH1.playerSixthCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 483, -80)
player3dealtCardsFrameSplitH1.playerSixthCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH1.playerSixthCardText:SetText("6th Card")
player3dealtCardsFrameSplitH1.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH1.playerSixthCardText:Hide()

player3dealtCardsFrameSplitH1.playerSeventhCardText = player3dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH1.playerSeventhCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH1, 576, -80)
player3dealtCardsFrameSplitH1.playerSeventhCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH1.playerSeventhCardText:SetText("7th Card")
player3dealtCardsFrameSplitH1.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

-- Player H2 Dealt Cards Frame
player3dealtCardsFrameSplitH2= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player3dealtCardsFrameSplitH2:SetSize(656, 200)
player3dealtCardsFrameSplitH2:SetPoint("BOTTOM", playerFrame, 0, 5)
player3dealtCardsFrameSplitH2:SetFrameStrata("HIGH")
player3dealtCardsFrameSplitH2:SetFrameLevel(5)
player3dealtCardsFrameSplitH2:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player3dealtCardsFrameSplitH2.playerH1CardsButton = CreateFrame("Button", nil, player3dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player3dealtCardsFrameSplitH2.playerH1CardsButton:SetPoint("TOPLEFT", player3dealtCardsFrameSplitH2, 8, -8)
player3dealtCardsFrameSplitH2.playerH1CardsButton:SetSize(75, 25)
player3dealtCardsFrameSplitH2.playerH1CardsButton:SetText("Hand 1")
player3dealtCardsFrameSplitH2.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player3dealtCardsFrameSplitH2.playerH2CardsButton = CreateFrame("Button", nil, player3dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player3dealtCardsFrameSplitH2.playerH2CardsButton:SetPoint("TOPLEFT", player3dealtCardsFrameSplitH2, 84, -8)
player3dealtCardsFrameSplitH2.playerH2CardsButton:SetSize(75, 25)
player3dealtCardsFrameSplitH2.playerH2CardsButton:SetText("Hand 2")
player3dealtCardsFrameSplitH2.playerH2CardsButton:Disable()
player3dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

player3dealtCardsFrameSplitH2.player3H2CardImage1 = player3dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH2.player3H2CardImage1:SetSize(85, 170)
player3dealtCardsFrameSplitH2.player3H2CardImage1:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 10, -7)
player3dealtCardsFrameSplitH2.player3H2CardImage1:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH2.player3H2CardImage1:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH2.player3H2CardImage2 = player3dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH2.player3H2CardImage2:SetSize(85, 170)
player3dealtCardsFrameSplitH2.player3H2CardImage2:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 102, -7)
player3dealtCardsFrameSplitH2.player3H2CardImage2:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH2.player3H2CardImage2:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH2.player3H2CardImage3 = player3dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH2.player3H2CardImage3:SetSize(85, 170)
player3dealtCardsFrameSplitH2.player3H2CardImage3:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 194, -7)
player3dealtCardsFrameSplitH2.player3H2CardImage3:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH2.player3H2CardImage3:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH2.player3H2CardImage4 = player3dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH2.player3H2CardImage4:SetSize(85, 170)
player3dealtCardsFrameSplitH2.player3H2CardImage4:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 286, -7)
player3dealtCardsFrameSplitH2.player3H2CardImage4:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH2.player3H2CardImage4:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH2.player3H2CardImage5 = player3dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH2.player3H2CardImage5:SetSize(85, 170)
player3dealtCardsFrameSplitH2.player3H2CardImage5:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 378, -7)
player3dealtCardsFrameSplitH2.player3H2CardImage5:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH2.player3H2CardImage5:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH2.player3H2CardImage6 = player3dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH2.player3H2CardImage6:SetSize(85, 170)
player3dealtCardsFrameSplitH2.player3H2CardImage6:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 470, -7)
player3dealtCardsFrameSplitH2.player3H2CardImage6:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH2.player3H2CardImage6:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH2.player3H2CardImage7 = player3dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player3dealtCardsFrameSplitH2.player3H2CardImage7:SetSize(85, 170)
player3dealtCardsFrameSplitH2.player3H2CardImage7:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 562, -7)
player3dealtCardsFrameSplitH2.player3H2CardImage7:SetBlendMode("BLEND")
player3dealtCardsFrameSplitH2.player3H2CardImage7:SetDrawLayer("ARTWORK")

player3dealtCardsFrameSplitH2.playerFirstCardText = player3dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH2.playerFirstCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 23, -80)
player3dealtCardsFrameSplitH2.playerFirstCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH2.playerFirstCardText:SetText("1st Card")
player3dealtCardsFrameSplitH2.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH2.playerFirstCardText:Hide()

player3dealtCardsFrameSplitH2.playerSecondCardText = player3dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH2.playerSecondCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 112, -80)
player3dealtCardsFrameSplitH2.playerSecondCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH2.playerSecondCardText:SetText("2nd Card")
player3dealtCardsFrameSplitH2.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH2.playerSecondCardText:Hide()

player3dealtCardsFrameSplitH2.playerThirdCardText = player3dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH2.playerThirdCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 207, -80)
player3dealtCardsFrameSplitH2.playerThirdCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH2.playerThirdCardText:SetText("3rd Card")
player3dealtCardsFrameSplitH2.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH2.playerThirdCardText:Hide()

player3dealtCardsFrameSplitH2.playerFourthCardText = player3dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH2.playerFourthCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 299, -80)
player3dealtCardsFrameSplitH2.playerFourthCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH2.playerFourthCardText:SetText("4th Card")
player3dealtCardsFrameSplitH2.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH2.playerFourthCardText:Hide()

player3dealtCardsFrameSplitH2.playerFifthCardText = player3dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH2.playerFifthCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 392, -80)
player3dealtCardsFrameSplitH2.playerFifthCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH2.playerFifthCardText:SetText("5th Card")
player3dealtCardsFrameSplitH2.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH2.playerFifthCardText:Hide()

player3dealtCardsFrameSplitH2.playerSixthCardText = player3dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH2.playerSixthCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 483, -80)
player3dealtCardsFrameSplitH2.playerSixthCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH2.playerSixthCardText:SetText("6th Card")
player3dealtCardsFrameSplitH2.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH2.playerSixthCardText:Hide()

player3dealtCardsFrameSplitH2.playerSeventhCardText = player3dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3dealtCardsFrameSplitH2.playerSeventhCardText:SetPoint("LEFT", player3dealtCardsFrameSplitH2, 576, -80)
player3dealtCardsFrameSplitH2.playerSeventhCardText:SetJustifyH("CENTER")
player3dealtCardsFrameSplitH2.playerSeventhCardText:SetText("7th Card")
player3dealtCardsFrameSplitH2.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player3dealtCardsFrameSplitH2.playerSeventhCardText:Hide()






-- >> PLAYER 4 <<
-- >> PLAYER 4 <<
-- >> PLAYER 4 <<

-- Player Dealt Cards Frame
player4dealtCardsFrame= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player4dealtCardsFrame:SetSize(656, 200)
player4dealtCardsFrame:SetPoint("BOTTOM", playerFrame, 0, 5)
player4dealtCardsFrame:SetFrameStrata("HIGH")
player4dealtCardsFrame:SetFrameLevel(6)
player4dealtCardsFrame:Hide()

-- "Player" button which displays Player's Main Hand cards
player4dealtCardsFrame.playerCardsButton = CreateFrame("Button", nil, player4dealtCardsFrame, "GameMenuButtonTemplate")
player4dealtCardsFrame.playerCardsButton:SetPoint("TOPLEFT", player4dealtCardsFrame, 8, -8)
player4dealtCardsFrame.playerCardsButton:SetSize(75, 25)
player4dealtCardsFrame.playerCardsButton:SetText("Player")
player4dealtCardsFrame.playerCardsButton:Disable()
player4dealtCardsFrame.playerCardsButton:Hide()


player4dealtCardsFrame.notStartedYetText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.notStartedYetText:SetPoint("CENTER", player4dealtCardsFrame, 0, 0)
player4dealtCardsFrame.notStartedYetText:SetJustifyH("CENTER")
player4dealtCardsFrame.notStartedYetText:SetText("The round hasn't started yet")
player4dealtCardsFrame.notStartedYetText:SetFont("Fonts\\FRIZQT__.TTF", 20, "OUTLINE")
player4dealtCardsFrame.notStartedYetText:Hide()

player4dealtCardsFrame.player4MainCardImage1 = player4dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrame.player4MainCardImage1:SetSize(85, 170)
player4dealtCardsFrame.player4MainCardImage1:SetPoint("LEFT", player4dealtCardsFrame, 10, -7)
player4dealtCardsFrame.player4MainCardImage1:SetBlendMode("BLEND")
player4dealtCardsFrame.player4MainCardImage1:SetDrawLayer("ARTWORK")

player4dealtCardsFrame.player4MainCardImage2 = player4dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrame.player4MainCardImage2:SetSize(85, 170)
player4dealtCardsFrame.player4MainCardImage2:SetPoint("LEFT", player4dealtCardsFrame, 102, -7)
player4dealtCardsFrame.player4MainCardImage2:SetBlendMode("BLEND")
player4dealtCardsFrame.player4MainCardImage2:SetDrawLayer("ARTWORK")

player4dealtCardsFrame.player4MainCardImage3 = player4dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrame.player4MainCardImage3:SetSize(85, 170)
player4dealtCardsFrame.player4MainCardImage3:SetPoint("LEFT", player4dealtCardsFrame, 194, -7)
player4dealtCardsFrame.player4MainCardImage3:SetBlendMode("BLEND")
player4dealtCardsFrame.player4MainCardImage3:SetDrawLayer("ARTWORK")

player4dealtCardsFrame.player4MainCardImage4 = player4dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrame.player4MainCardImage4:SetSize(85, 170)
player4dealtCardsFrame.player4MainCardImage4:SetPoint("LEFT", player4dealtCardsFrame, 286, -7)
player4dealtCardsFrame.player4MainCardImage4:SetBlendMode("BLEND")
player4dealtCardsFrame.player4MainCardImage4:SetDrawLayer("ARTWORK")

player4dealtCardsFrame.player4MainCardImage5 = player4dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrame.player4MainCardImage5:SetSize(85, 170)
player4dealtCardsFrame.player4MainCardImage5:SetPoint("LEFT", player4dealtCardsFrame, 378, -7)
player4dealtCardsFrame.player4MainCardImage5:SetBlendMode("BLEND")
player4dealtCardsFrame.player4MainCardImage5:SetDrawLayer("ARTWORK")

player4dealtCardsFrame.player4MainCardImage6 = player4dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrame.player4MainCardImage6:SetSize(85, 170)
player4dealtCardsFrame.player4MainCardImage6:SetPoint("LEFT", player4dealtCardsFrame, 470, -7)
player4dealtCardsFrame.player4MainCardImage6:SetBlendMode("BLEND")
player4dealtCardsFrame.player4MainCardImage6:SetDrawLayer("ARTWORK")

player4dealtCardsFrame.player4MainCardImage7 = player4dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrame.player4MainCardImage7:SetSize(85, 170)
player4dealtCardsFrame.player4MainCardImage7:SetPoint("LEFT", player4dealtCardsFrame, 562, -7)
player4dealtCardsFrame.player4MainCardImage7:SetBlendMode("BLEND")
player4dealtCardsFrame.player4MainCardImage7:SetDrawLayer("ARTWORK")

player4dealtCardsFrame.playerFirstCardText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.playerFirstCardText:SetPoint("LEFT", player4dealtCardsFrame, 23, -80)
player4dealtCardsFrame.playerFirstCardText:SetJustifyH("CENTER")
player4dealtCardsFrame.playerFirstCardText:SetText("1st Card")
player4dealtCardsFrame.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrame.playerFirstCardText:Hide()

player4dealtCardsFrame.playerSecondCardText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.playerSecondCardText:SetPoint("LEFT", player4dealtCardsFrame, 112, -80)
player4dealtCardsFrame.playerSecondCardText:SetJustifyH("CENTER")
player4dealtCardsFrame.playerSecondCardText:SetText("2nd Card")
player4dealtCardsFrame.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrame.playerSecondCardText:Hide()

player4dealtCardsFrame.playerThirdCardText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.playerThirdCardText:SetPoint("LEFT", player4dealtCardsFrame, 207, -80)
player4dealtCardsFrame.playerThirdCardText:SetJustifyH("CENTER")
player4dealtCardsFrame.playerThirdCardText:SetText("3rd Card")
player4dealtCardsFrame.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrame.playerThirdCardText:Hide()

player4dealtCardsFrame.playerFourthCardText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.playerFourthCardText:SetPoint("LEFT", player4dealtCardsFrame, 299, -80)
player4dealtCardsFrame.playerFourthCardText:SetJustifyH("CENTER")
player4dealtCardsFrame.playerFourthCardText:SetText("4th Card")
player4dealtCardsFrame.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrame.playerFourthCardText:Hide()

player4dealtCardsFrame.playerFifthCardText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.playerFifthCardText:SetPoint("LEFT", player4dealtCardsFrame, 392, -80)
player4dealtCardsFrame.playerFifthCardText:SetJustifyH("CENTER")
player4dealtCardsFrame.playerFifthCardText:SetText("5th Card")
player4dealtCardsFrame.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrame.playerFifthCardText:Hide()

player4dealtCardsFrame.playerSixthCardText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.playerSixthCardText:SetPoint("LEFT", player4dealtCardsFrame, 483, -80)
player4dealtCardsFrame.playerSixthCardText:SetJustifyH("CENTER")
player4dealtCardsFrame.playerSixthCardText:SetText("6th Card")
player4dealtCardsFrame.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrame.playerSixthCardText:Hide()

player4dealtCardsFrame.playerSeventhCardText = player4dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrame.playerSeventhCardText:SetPoint("LEFT", player4dealtCardsFrame, 576, -80)
player4dealtCardsFrame.playerSeventhCardText:SetJustifyH("CENTER")
player4dealtCardsFrame.playerSeventhCardText:SetText("7th Card")
player4dealtCardsFrame.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrame.playerSeventhCardText:Hide()

-- Player H1 Dealt Cards Frame
player4dealtCardsFrameSplitH1= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player4dealtCardsFrameSplitH1:SetSize(656, 200)
player4dealtCardsFrameSplitH1:SetPoint("BOTTOM", playerFrame, 0, 5)
player4dealtCardsFrameSplitH1:SetFrameStrata("HIGH")
player4dealtCardsFrameSplitH1:SetFrameLevel(5)
player4dealtCardsFrameSplitH1:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player4dealtCardsFrameSplitH1.playerH1CardsButton = CreateFrame("Button", nil, player4dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player4dealtCardsFrameSplitH1.playerH1CardsButton:SetPoint("TOPLEFT", player4dealtCardsFrameSplitH1, 8, -8)
player4dealtCardsFrameSplitH1.playerH1CardsButton:SetSize(75, 25)
player4dealtCardsFrameSplitH1.playerH1CardsButton:SetText("Hand 1")
player4dealtCardsFrameSplitH1.playerH1CardsButton:Disable()
player4dealtCardsFrameSplitH1.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player4dealtCardsFrameSplitH1.playerH2CardsButton = CreateFrame("Button", nil, player4dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player4dealtCardsFrameSplitH1.playerH2CardsButton:SetPoint("TOPLEFT", player4dealtCardsFrameSplitH1, 84, -8)
player4dealtCardsFrameSplitH1.playerH2CardsButton:SetSize(75, 25)
player4dealtCardsFrameSplitH1.playerH2CardsButton:SetText("Hand 2")
player4dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

player4dealtCardsFrameSplitH1.player4H1CardImage1 = player4dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH1.player4H1CardImage1:SetSize(85, 170)
player4dealtCardsFrameSplitH1.player4H1CardImage1:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 10, -7)
player4dealtCardsFrameSplitH1.player4H1CardImage1:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH1.player4H1CardImage1:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH1.player4H1CardImage2 = player4dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH1.player4H1CardImage2:SetSize(85, 170)
player4dealtCardsFrameSplitH1.player4H1CardImage2:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 102, -7)
player4dealtCardsFrameSplitH1.player4H1CardImage2:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH1.player4H1CardImage2:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH1.player4H1CardImage3 = player4dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH1.player4H1CardImage3:SetSize(85, 170)
player4dealtCardsFrameSplitH1.player4H1CardImage3:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 194, -7)
player4dealtCardsFrameSplitH1.player4H1CardImage3:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH1.player4H1CardImage3:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH1.player4H1CardImage4 = player4dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH1.player4H1CardImage4:SetSize(85, 170)
player4dealtCardsFrameSplitH1.player4H1CardImage4:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 286, -7)
player4dealtCardsFrameSplitH1.player4H1CardImage4:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH1.player4H1CardImage4:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH1.player4H1CardImage5 = player4dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH1.player4H1CardImage5:SetSize(85, 170)
player4dealtCardsFrameSplitH1.player4H1CardImage5:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 378, -7)
player4dealtCardsFrameSplitH1.player4H1CardImage5:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH1.player4H1CardImage5:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH1.player4H1CardImage6 = player4dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH1.player4H1CardImage6:SetSize(85, 170)
player4dealtCardsFrameSplitH1.player4H1CardImage6:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 470, -7)
player4dealtCardsFrameSplitH1.player4H1CardImage6:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH1.player4H1CardImage6:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH1.player4H1CardImage7 = player4dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH1.player4H1CardImage7:SetSize(85, 170)
player4dealtCardsFrameSplitH1.player4H1CardImage7:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 562, -7)
player4dealtCardsFrameSplitH1.player4H1CardImage7:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH1.player4H1CardImage7:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH1.playerFirstCardText = player4dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH1.playerFirstCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 23, -80)
player4dealtCardsFrameSplitH1.playerFirstCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH1.playerFirstCardText:SetText("1st Card")
player4dealtCardsFrameSplitH1.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH1.playerFirstCardText:Hide()

player4dealtCardsFrameSplitH1.playerSecondCardText = player4dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH1.playerSecondCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 112, -80)
player4dealtCardsFrameSplitH1.playerSecondCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH1.playerSecondCardText:SetText("2nd Card")
player4dealtCardsFrameSplitH1.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH1.playerSecondCardText:Hide()

player4dealtCardsFrameSplitH1.playerThirdCardText = player4dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH1.playerThirdCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 207, -80)
player4dealtCardsFrameSplitH1.playerThirdCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH1.playerThirdCardText:SetText("3rd Card")
player4dealtCardsFrameSplitH1.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH1.playerThirdCardText:Hide()

player4dealtCardsFrameSplitH1.playerFourthCardText = player4dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH1.playerFourthCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 299, -80)
player4dealtCardsFrameSplitH1.playerFourthCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH1.playerFourthCardText:SetText("4th Card")
player4dealtCardsFrameSplitH1.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH1.playerFourthCardText:Hide()

player4dealtCardsFrameSplitH1.playerFifthCardText = player4dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH1.playerFifthCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 392, -80)
player4dealtCardsFrameSplitH1.playerFifthCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH1.playerFifthCardText:SetText("5th Card")
player4dealtCardsFrameSplitH1.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH1.playerFifthCardText:Hide()

player4dealtCardsFrameSplitH1.playerSixthCardText = player4dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH1.playerSixthCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 483, -80)
player4dealtCardsFrameSplitH1.playerSixthCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH1.playerSixthCardText:SetText("6th Card")
player4dealtCardsFrameSplitH1.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH1.playerSixthCardText:Hide()

player4dealtCardsFrameSplitH1.playerSeventhCardText = player4dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH1.playerSeventhCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH1, 576, -80)
player4dealtCardsFrameSplitH1.playerSeventhCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH1.playerSeventhCardText:SetText("7th Card")
player4dealtCardsFrameSplitH1.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

-- Player H2 Dealt Cards Frame
player4dealtCardsFrameSplitH2= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player4dealtCardsFrameSplitH2:SetSize(656, 200)
player4dealtCardsFrameSplitH2:SetPoint("BOTTOM", playerFrame, 0, 5)
player4dealtCardsFrameSplitH2:SetFrameStrata("HIGH")
player4dealtCardsFrameSplitH2:SetFrameLevel(5)
player4dealtCardsFrameSplitH2:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player4dealtCardsFrameSplitH2.playerH1CardsButton = CreateFrame("Button", nil, player4dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player4dealtCardsFrameSplitH2.playerH1CardsButton:SetPoint("TOPLEFT", player4dealtCardsFrameSplitH2, 8, -8)
player4dealtCardsFrameSplitH2.playerH1CardsButton:SetSize(75, 25)
player4dealtCardsFrameSplitH2.playerH1CardsButton:SetText("Hand 1")
player4dealtCardsFrameSplitH2.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player4dealtCardsFrameSplitH2.playerH2CardsButton = CreateFrame("Button", nil, player4dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player4dealtCardsFrameSplitH2.playerH2CardsButton:SetPoint("TOPLEFT", player4dealtCardsFrameSplitH2, 84, -8)
player4dealtCardsFrameSplitH2.playerH2CardsButton:SetSize(75, 25)
player4dealtCardsFrameSplitH2.playerH2CardsButton:SetText("Hand 2")
player4dealtCardsFrameSplitH2.playerH2CardsButton:Disable()
player4dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

player4dealtCardsFrameSplitH2.player4H2CardImage1 = player4dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH2.player4H2CardImage1:SetSize(85, 170)
player4dealtCardsFrameSplitH2.player4H2CardImage1:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 10, -7)
player4dealtCardsFrameSplitH2.player4H2CardImage1:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH2.player4H2CardImage1:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH2.player4H2CardImage2 = player4dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH2.player4H2CardImage2:SetSize(85, 170)
player4dealtCardsFrameSplitH2.player4H2CardImage2:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 102, -7)
player4dealtCardsFrameSplitH2.player4H2CardImage2:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH2.player4H2CardImage2:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH2.player4H2CardImage3 = player4dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH2.player4H2CardImage3:SetSize(85, 170)
player4dealtCardsFrameSplitH2.player4H2CardImage3:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 194, -7)
player4dealtCardsFrameSplitH2.player4H2CardImage3:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH2.player4H2CardImage3:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH2.player4H2CardImage4 = player4dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH2.player4H2CardImage4:SetSize(85, 170)
player4dealtCardsFrameSplitH2.player4H2CardImage4:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 286, -7)
player4dealtCardsFrameSplitH2.player4H2CardImage4:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH2.player4H2CardImage4:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH2.player4H2CardImage5 = player4dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH2.player4H2CardImage5:SetSize(85, 170)
player4dealtCardsFrameSplitH2.player4H2CardImage5:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 378, -7)
player4dealtCardsFrameSplitH2.player4H2CardImage5:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH2.player4H2CardImage5:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH2.player4H2CardImage6 = player4dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH2.player4H2CardImage6:SetSize(85, 170)
player4dealtCardsFrameSplitH2.player4H2CardImage6:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 470, -7)
player4dealtCardsFrameSplitH2.player4H2CardImage6:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH2.player4H2CardImage6:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH2.player4H2CardImage7 = player4dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player4dealtCardsFrameSplitH2.player4H2CardImage7:SetSize(85, 170)
player4dealtCardsFrameSplitH2.player4H2CardImage7:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 562, -7)
player4dealtCardsFrameSplitH2.player4H2CardImage7:SetBlendMode("BLEND")
player4dealtCardsFrameSplitH2.player4H2CardImage7:SetDrawLayer("ARTWORK")

player4dealtCardsFrameSplitH2.playerFirstCardText = player4dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH2.playerFirstCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 23, -80)
player4dealtCardsFrameSplitH2.playerFirstCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH2.playerFirstCardText:SetText("1st Card")
player4dealtCardsFrameSplitH2.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH2.playerFirstCardText:Hide()

player4dealtCardsFrameSplitH2.playerSecondCardText = player4dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH2.playerSecondCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 112, -80)
player4dealtCardsFrameSplitH2.playerSecondCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH2.playerSecondCardText:SetText("2nd Card")
player4dealtCardsFrameSplitH2.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH2.playerSecondCardText:Hide()

player4dealtCardsFrameSplitH2.playerThirdCardText = player4dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH2.playerThirdCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 207, -80)
player4dealtCardsFrameSplitH2.playerThirdCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH2.playerThirdCardText:SetText("3rd Card")
player4dealtCardsFrameSplitH2.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH2.playerThirdCardText:Hide()

player4dealtCardsFrameSplitH2.playerFourthCardText = player4dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH2.playerFourthCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 299, -80)
player4dealtCardsFrameSplitH2.playerFourthCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH2.playerFourthCardText:SetText("4th Card")
player4dealtCardsFrameSplitH2.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH2.playerFourthCardText:Hide()

player4dealtCardsFrameSplitH2.playerFifthCardText = player4dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH2.playerFifthCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 392, -80)
player4dealtCardsFrameSplitH2.playerFifthCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH2.playerFifthCardText:SetText("5th Card")
player4dealtCardsFrameSplitH2.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH2.playerFifthCardText:Hide()

player4dealtCardsFrameSplitH2.playerSixthCardText = player4dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH2.playerSixthCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 483, -80)
player4dealtCardsFrameSplitH2.playerSixthCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH2.playerSixthCardText:SetText("6th Card")
player4dealtCardsFrameSplitH2.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH2.playerSixthCardText:Hide()

player4dealtCardsFrameSplitH2.playerSeventhCardText = player4dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4dealtCardsFrameSplitH2.playerSeventhCardText:SetPoint("LEFT", player4dealtCardsFrameSplitH2, 576, -80)
player4dealtCardsFrameSplitH2.playerSeventhCardText:SetJustifyH("CENTER")
player4dealtCardsFrameSplitH2.playerSeventhCardText:SetText("7th Card")
player4dealtCardsFrameSplitH2.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player4dealtCardsFrameSplitH2.playerSeventhCardText:Hide()






-- >> PLAYER 5 <<
-- >> PLAYER 5 <<
-- >> PLAYER 5 <<

-- Player Dealt Cards Frame
player5dealtCardsFrame= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player5dealtCardsFrame:SetSize(656, 200)
player5dealtCardsFrame:SetPoint("BOTTOM", playerFrame, 0, 5)
player5dealtCardsFrame:SetFrameStrata("HIGH")
player5dealtCardsFrame:SetFrameLevel(6)
player5dealtCardsFrame:Hide()

-- "Player" button which displays Player's Main Hand cards
player5dealtCardsFrame.playerCardsButton = CreateFrame("Button", nil, player5dealtCardsFrame, "GameMenuButtonTemplate")
player5dealtCardsFrame.playerCardsButton:SetPoint("TOPLEFT", player5dealtCardsFrame, 8, -8)
player5dealtCardsFrame.playerCardsButton:SetSize(75, 25)
player5dealtCardsFrame.playerCardsButton:SetText("Player")
player5dealtCardsFrame.playerCardsButton:Disable()
player5dealtCardsFrame.playerCardsButton:Hide()

player5dealtCardsFrame.notStartedYetText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.notStartedYetText:SetPoint("CENTER", player5dealtCardsFrame, 0, 0)
player5dealtCardsFrame.notStartedYetText:SetJustifyH("CENTER")
player5dealtCardsFrame.notStartedYetText:SetText("The round hasn't started yet")
player5dealtCardsFrame.notStartedYetText:SetFont("Fonts\\FRIZQT__.TTF", 20, "OUTLINE")
player5dealtCardsFrame.notStartedYetText:Hide()

player5dealtCardsFrame.player5MainCardImage1 = player5dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrame.player5MainCardImage1:SetSize(85, 170)
player5dealtCardsFrame.player5MainCardImage1:SetPoint("LEFT", player5dealtCardsFrame, 10, -7)
player5dealtCardsFrame.player5MainCardImage1:SetBlendMode("BLEND")
player5dealtCardsFrame.player5MainCardImage1:SetDrawLayer("ARTWORK")

player5dealtCardsFrame.player5MainCardImage2 = player5dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrame.player5MainCardImage2:SetSize(85, 170)
player5dealtCardsFrame.player5MainCardImage2:SetPoint("LEFT", player5dealtCardsFrame, 102, -7)
player5dealtCardsFrame.player5MainCardImage2:SetBlendMode("BLEND")
player5dealtCardsFrame.player5MainCardImage2:SetDrawLayer("ARTWORK")

player5dealtCardsFrame.player5MainCardImage3 = player5dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrame.player5MainCardImage3:SetSize(85, 170)
player5dealtCardsFrame.player5MainCardImage3:SetPoint("LEFT", player5dealtCardsFrame, 194, -7)
player5dealtCardsFrame.player5MainCardImage3:SetBlendMode("BLEND")
player5dealtCardsFrame.player5MainCardImage3:SetDrawLayer("ARTWORK")

player5dealtCardsFrame.player5MainCardImage4 = player5dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrame.player5MainCardImage4:SetSize(85, 170)
player5dealtCardsFrame.player5MainCardImage4:SetPoint("LEFT", player5dealtCardsFrame, 286, -7)
player5dealtCardsFrame.player5MainCardImage4:SetBlendMode("BLEND")
player5dealtCardsFrame.player5MainCardImage4:SetDrawLayer("ARTWORK")

player5dealtCardsFrame.player5MainCardImage5 = player5dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrame.player5MainCardImage5:SetSize(85, 170)
player5dealtCardsFrame.player5MainCardImage5:SetPoint("LEFT", player5dealtCardsFrame, 378, -7)
player5dealtCardsFrame.player5MainCardImage5:SetBlendMode("BLEND")
player5dealtCardsFrame.player5MainCardImage5:SetDrawLayer("ARTWORK")

player5dealtCardsFrame.player5MainCardImage6 = player5dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrame.player5MainCardImage6:SetSize(85, 170)
player5dealtCardsFrame.player5MainCardImage6:SetPoint("LEFT", player5dealtCardsFrame, 470, -7)
player5dealtCardsFrame.player5MainCardImage6:SetBlendMode("BLEND")
player5dealtCardsFrame.player5MainCardImage6:SetDrawLayer("ARTWORK")

player5dealtCardsFrame.player5MainCardImage7 = player5dealtCardsFrame:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrame.player5MainCardImage7:SetSize(85, 170)
player5dealtCardsFrame.player5MainCardImage7:SetPoint("LEFT", player5dealtCardsFrame, 562, -7)
player5dealtCardsFrame.player5MainCardImage7:SetBlendMode("BLEND")
player5dealtCardsFrame.player5MainCardImage7:SetDrawLayer("ARTWORK")

player5dealtCardsFrame.playerFirstCardText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.playerFirstCardText:SetPoint("LEFT", player5dealtCardsFrame, 23, -80)
player5dealtCardsFrame.playerFirstCardText:SetJustifyH("CENTER")
player5dealtCardsFrame.playerFirstCardText:SetText("1st Card")
player5dealtCardsFrame.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrame.playerFirstCardText:Hide()

player5dealtCardsFrame.playerSecondCardText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.playerSecondCardText:SetPoint("LEFT", player5dealtCardsFrame, 112, -80)
player5dealtCardsFrame.playerSecondCardText:SetJustifyH("CENTER")
player5dealtCardsFrame.playerSecondCardText:SetText("2nd Card")
player5dealtCardsFrame.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrame.playerSecondCardText:Hide()

player5dealtCardsFrame.playerThirdCardText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.playerThirdCardText:SetPoint("LEFT", player5dealtCardsFrame, 207, -80)
player5dealtCardsFrame.playerThirdCardText:SetJustifyH("CENTER")
player5dealtCardsFrame.playerThirdCardText:SetText("3rd Card")
player5dealtCardsFrame.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrame.playerThirdCardText:Hide()

player5dealtCardsFrame.playerFourthCardText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.playerFourthCardText:SetPoint("LEFT", player5dealtCardsFrame, 299, -80)
player5dealtCardsFrame.playerFourthCardText:SetJustifyH("CENTER")
player5dealtCardsFrame.playerFourthCardText:SetText("4th Card")
player5dealtCardsFrame.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrame.playerFourthCardText:Hide()

player5dealtCardsFrame.playerFifthCardText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.playerFifthCardText:SetPoint("LEFT", player5dealtCardsFrame, 392, -80)
player5dealtCardsFrame.playerFifthCardText:SetJustifyH("CENTER")
player5dealtCardsFrame.playerFifthCardText:SetText("5th Card")
player5dealtCardsFrame.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrame.playerFifthCardText:Hide()

player5dealtCardsFrame.playerSixthCardText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.playerSixthCardText:SetPoint("LEFT", player5dealtCardsFrame, 483, -80)
player5dealtCardsFrame.playerSixthCardText:SetJustifyH("CENTER")
player5dealtCardsFrame.playerSixthCardText:SetText("6th Card")
player5dealtCardsFrame.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrame.playerSixthCardText:Hide()

player5dealtCardsFrame.playerSeventhCardText = player5dealtCardsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrame.playerSeventhCardText:SetPoint("LEFT", player5dealtCardsFrame, 576, -80)
player5dealtCardsFrame.playerSeventhCardText:SetJustifyH("CENTER")
player5dealtCardsFrame.playerSeventhCardText:SetText("7th Card")
player5dealtCardsFrame.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrame.playerSeventhCardText:Hide()

-- Player H1 Dealt Cards Frame
player5dealtCardsFrameSplitH1= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player5dealtCardsFrameSplitH1:SetSize(656, 200)
player5dealtCardsFrameSplitH1:SetPoint("BOTTOM", playerFrame, 0, 5)
player5dealtCardsFrameSplitH1:SetFrameStrata("HIGH")
player5dealtCardsFrameSplitH1:SetFrameLevel(5)
player5dealtCardsFrameSplitH1:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player5dealtCardsFrameSplitH1.playerH1CardsButton = CreateFrame("Button", nil, player5dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player5dealtCardsFrameSplitH1.playerH1CardsButton:SetPoint("TOPLEFT", player5dealtCardsFrameSplitH1, 8, -8)
player5dealtCardsFrameSplitH1.playerH1CardsButton:SetSize(75, 25)
player5dealtCardsFrameSplitH1.playerH1CardsButton:SetText("Hand 1")
player5dealtCardsFrameSplitH1.playerH1CardsButton:Disable()
player5dealtCardsFrameSplitH1.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player5dealtCardsFrameSplitH1.playerH2CardsButton = CreateFrame("Button", nil, player5dealtCardsFrameSplitH1, "GameMenuButtonTemplate")
player5dealtCardsFrameSplitH1.playerH2CardsButton:SetPoint("TOPLEFT", player5dealtCardsFrameSplitH1, 84, -8)
player5dealtCardsFrameSplitH1.playerH2CardsButton:SetSize(75, 25)
player5dealtCardsFrameSplitH1.playerH2CardsButton:SetText("Hand 2")
player5dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

player5dealtCardsFrameSplitH1.player5H1CardImage1 = player5dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH1.player5H1CardImage1:SetSize(85, 170)
player5dealtCardsFrameSplitH1.player5H1CardImage1:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 10, -7)
player5dealtCardsFrameSplitH1.player5H1CardImage1:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH1.player5H1CardImage1:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH1.player5H1CardImage2 = player5dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH1.player5H1CardImage2:SetSize(85, 170)
player5dealtCardsFrameSplitH1.player5H1CardImage2:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 102, -7)
player5dealtCardsFrameSplitH1.player5H1CardImage2:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH1.player5H1CardImage2:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH1.player5H1CardImage3 = player5dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH1.player5H1CardImage3:SetSize(85, 170)
player5dealtCardsFrameSplitH1.player5H1CardImage3:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 194, -7)
player5dealtCardsFrameSplitH1.player5H1CardImage3:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH1.player5H1CardImage3:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH1.player5H1CardImage4 = player5dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH1.player5H1CardImage4:SetSize(85, 170)
player5dealtCardsFrameSplitH1.player5H1CardImage4:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 286, -7)
player5dealtCardsFrameSplitH1.player5H1CardImage4:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH1.player5H1CardImage4:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH1.player5H1CardImage5 = player5dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH1.player5H1CardImage5:SetSize(85, 170)
player5dealtCardsFrameSplitH1.player5H1CardImage5:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 378, -7)
player5dealtCardsFrameSplitH1.player5H1CardImage5:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH1.player5H1CardImage5:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH1.player5H1CardImage6 = player5dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH1.player5H1CardImage6:SetSize(85, 170)
player5dealtCardsFrameSplitH1.player5H1CardImage6:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 470, -7)
player5dealtCardsFrameSplitH1.player5H1CardImage6:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH1.player5H1CardImage6:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH1.player5H1CardImage7 = player5dealtCardsFrameSplitH1:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH1.player5H1CardImage7:SetSize(85, 170)
player5dealtCardsFrameSplitH1.player5H1CardImage7:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 562, -7)
player5dealtCardsFrameSplitH1.player5H1CardImage7:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH1.player5H1CardImage7:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH1.playerFirstCardText = player5dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH1.playerFirstCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 23, -80)
player5dealtCardsFrameSplitH1.playerFirstCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH1.playerFirstCardText:SetText("1st Card")
player5dealtCardsFrameSplitH1.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH1.playerFirstCardText:Hide()

player5dealtCardsFrameSplitH1.playerSecondCardText = player5dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH1.playerSecondCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 112, -80)
player5dealtCardsFrameSplitH1.playerSecondCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH1.playerSecondCardText:SetText("2nd Card")
player5dealtCardsFrameSplitH1.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH1.playerSecondCardText:Hide()

player5dealtCardsFrameSplitH1.playerThirdCardText = player5dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH1.playerThirdCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 207, -80)
player5dealtCardsFrameSplitH1.playerThirdCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH1.playerThirdCardText:SetText("3rd Card")
player5dealtCardsFrameSplitH1.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH1.playerThirdCardText:Hide()

player5dealtCardsFrameSplitH1.playerFourthCardText = player5dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH1.playerFourthCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 299, -80)
player5dealtCardsFrameSplitH1.playerFourthCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH1.playerFourthCardText:SetText("4th Card")
player5dealtCardsFrameSplitH1.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH1.playerFourthCardText:Hide()

player5dealtCardsFrameSplitH1.playerFifthCardText = player5dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH1.playerFifthCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 392, -80)
player5dealtCardsFrameSplitH1.playerFifthCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH1.playerFifthCardText:SetText("5th Card")
player5dealtCardsFrameSplitH1.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH1.playerFifthCardText:Hide()

player5dealtCardsFrameSplitH1.playerSixthCardText = player5dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH1.playerSixthCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 483, -80)
player5dealtCardsFrameSplitH1.playerSixthCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH1.playerSixthCardText:SetText("6th Card")
player5dealtCardsFrameSplitH1.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH1.playerSixthCardText:Hide()

player5dealtCardsFrameSplitH1.playerSeventhCardText = player5dealtCardsFrameSplitH1:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH1.playerSeventhCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH1, 576, -80)
player5dealtCardsFrameSplitH1.playerSeventhCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH1.playerSeventhCardText:SetText("7th Card")
player5dealtCardsFrameSplitH1.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

-- Player H2 Dealt Cards Frame
player5dealtCardsFrameSplitH2= CreateFrame("Frame", "BlackjackDealtCardsFrame", UIParent, "InsetFrameTemplate")
player5dealtCardsFrameSplitH2:SetSize(656, 200)
player5dealtCardsFrameSplitH2:SetPoint("BOTTOM", playerFrame, 0, 5)
player5dealtCardsFrameSplitH2:SetFrameStrata("HIGH")
player5dealtCardsFrameSplitH2:SetFrameLevel(5)
player5dealtCardsFrameSplitH2:Hide()

-- "Hand 1" button which displays Player's Hand 1 cards
player5dealtCardsFrameSplitH2.playerH1CardsButton = CreateFrame("Button", nil, player5dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player5dealtCardsFrameSplitH2.playerH1CardsButton:SetPoint("TOPLEFT", player5dealtCardsFrameSplitH2, 8, -8)
player5dealtCardsFrameSplitH2.playerH1CardsButton:SetSize(75, 25)
player5dealtCardsFrameSplitH2.playerH1CardsButton:SetText("Hand 1")
player5dealtCardsFrameSplitH2.playerH1CardsButton:Hide()

-- "Hand 2" button which displays Player's Hand 2 cards
player5dealtCardsFrameSplitH2.playerH2CardsButton = CreateFrame("Button", nil, player5dealtCardsFrameSplitH2, "GameMenuButtonTemplate")
player5dealtCardsFrameSplitH2.playerH2CardsButton:SetPoint("TOPLEFT", player5dealtCardsFrameSplitH2, 84, -8)
player5dealtCardsFrameSplitH2.playerH2CardsButton:SetSize(75, 25)
player5dealtCardsFrameSplitH2.playerH2CardsButton:SetText("Hand 2")
player5dealtCardsFrameSplitH2.playerH2CardsButton:Disable()
player5dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

player5dealtCardsFrameSplitH2.player5H2CardImage1 = player5dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH2.player5H2CardImage1:SetSize(85, 170)
player5dealtCardsFrameSplitH2.player5H2CardImage1:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 10, -7)
player5dealtCardsFrameSplitH2.player5H2CardImage1:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH2.player5H2CardImage1:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH2.player5H2CardImage2 = player5dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH2.player5H2CardImage2:SetSize(85, 170)
player5dealtCardsFrameSplitH2.player5H2CardImage2:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 102, -7)
player5dealtCardsFrameSplitH2.player5H2CardImage2:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH2.player5H2CardImage2:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH2.player5H2CardImage3 = player5dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH2.player5H2CardImage3:SetSize(85, 170)
player5dealtCardsFrameSplitH2.player5H2CardImage3:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 194, -7)
player5dealtCardsFrameSplitH2.player5H2CardImage3:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH2.player5H2CardImage3:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH2.player5H2CardImage4 = player5dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH2.player5H2CardImage4:SetSize(85, 170)
player5dealtCardsFrameSplitH2.player5H2CardImage4:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 286, -7)
player5dealtCardsFrameSplitH2.player5H2CardImage4:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH2.player5H2CardImage4:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH2.player5H2CardImage5 = player5dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH2.player5H2CardImage5:SetSize(85, 170)
player5dealtCardsFrameSplitH2.player5H2CardImage5:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 378, -7)
player5dealtCardsFrameSplitH2.player5H2CardImage5:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH2.player5H2CardImage5:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH2.player5H2CardImage6 = player5dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH2.player5H2CardImage6:SetSize(85, 170)
player5dealtCardsFrameSplitH2.player5H2CardImage6:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 470, -7)
player5dealtCardsFrameSplitH2.player5H2CardImage6:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH2.player5H2CardImage6:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH2.player5H2CardImage7 = player5dealtCardsFrameSplitH2:CreateTexture(nil, "OVERLAY")
player5dealtCardsFrameSplitH2.player5H2CardImage7:SetSize(85, 170)
player5dealtCardsFrameSplitH2.player5H2CardImage7:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 562, -7)
player5dealtCardsFrameSplitH2.player5H2CardImage7:SetBlendMode("BLEND")
player5dealtCardsFrameSplitH2.player5H2CardImage7:SetDrawLayer("ARTWORK")

player5dealtCardsFrameSplitH2.playerFirstCardText = player5dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH2.playerFirstCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 23, -80)
player5dealtCardsFrameSplitH2.playerFirstCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH2.playerFirstCardText:SetText("1st Card")
player5dealtCardsFrameSplitH2.playerFirstCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH2.playerFirstCardText:Hide()

player5dealtCardsFrameSplitH2.playerSecondCardText = player5dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH2.playerSecondCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 112, -80)
player5dealtCardsFrameSplitH2.playerSecondCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH2.playerSecondCardText:SetText("2nd Card")
player5dealtCardsFrameSplitH2.playerSecondCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH2.playerSecondCardText:Hide()

player5dealtCardsFrameSplitH2.playerThirdCardText = player5dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH2.playerThirdCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 207, -80)
player5dealtCardsFrameSplitH2.playerThirdCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH2.playerThirdCardText:SetText("3rd Card")
player5dealtCardsFrameSplitH2.playerThirdCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH2.playerThirdCardText:Hide()

player5dealtCardsFrameSplitH2.playerFourthCardText = player5dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH2.playerFourthCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 299, -80)
player5dealtCardsFrameSplitH2.playerFourthCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH2.playerFourthCardText:SetText("4th Card")
player5dealtCardsFrameSplitH2.playerFourthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH2.playerFourthCardText:Hide()

player5dealtCardsFrameSplitH2.playerFifthCardText = player5dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH2.playerFifthCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 392, -80)
player5dealtCardsFrameSplitH2.playerFifthCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH2.playerFifthCardText:SetText("5th Card")
player5dealtCardsFrameSplitH2.playerFifthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH2.playerFifthCardText:Hide()

player5dealtCardsFrameSplitH2.playerSixthCardText = player5dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH2.playerSixthCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 483, -80)
player5dealtCardsFrameSplitH2.playerSixthCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH2.playerSixthCardText:SetText("6th Card")
player5dealtCardsFrameSplitH2.playerSixthCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH2.playerSixthCardText:Hide()

player5dealtCardsFrameSplitH2.playerSeventhCardText = player5dealtCardsFrameSplitH2:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5dealtCardsFrameSplitH2.playerSeventhCardText:SetPoint("LEFT", player5dealtCardsFrameSplitH2, 576, -80)
player5dealtCardsFrameSplitH2.playerSeventhCardText:SetJustifyH("CENTER")
player5dealtCardsFrameSplitH2.playerSeventhCardText:SetText("7th Card")
player5dealtCardsFrameSplitH2.playerSeventhCardText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
player5dealtCardsFrameSplitH2.playerSeventhCardText:Hide()

















-- >> CHAT WINDOW <<
-- >> CHAT WINDOW <<
-- >> CHAT WINDOW <<

local chatWindowHeight = 180
local totalHeight = 168
local lineHeight = 10

-- Create the chat window frame
chatWindowFrame = CreateFrame("Frame", "BlackjackChatWindowFrame", UIParent, "InsetFrameTemplate")
chatWindowFrame:SetSize(306, 200)
chatWindowFrame:SetPoint("BOTTOMRIGHT", playerFrame, -5, 5)
chatWindowFrame:SetFrameStrata("HIGH")
chatWindowFrame:SetFrameLevel(5)
chatWindowFrame:Hide()

-- Setting a title
chatWindowFrame.title = chatWindowFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
chatWindowFrame.title:SetPoint("TOP", chatWindowFrame, 0, -7)
chatWindowFrame.title:SetText("Chat Log")

-- Create the scroll frame
chatWindowFrame.ScrollFrame = CreateFrame("ScrollFrame", nil, chatWindowFrame, "UIPanelScrollFrameTemplate")
chatWindowFrame.ScrollFrame:SetPoint("TOPLEFT", chatWindowFrame, "TOPLEFT", 10, -27)
chatWindowFrame.ScrollFrame:SetPoint("BOTTOMRIGHT", chatWindowFrame, "BOTTOMRIGHT", -10, 9)
chatWindowFrame.ScrollFrame:SetClipsChildren(true)

-- Create the child frame for scrolling content
local child = CreateFrame("Frame", nil, chatWindowFrame.ScrollFrame)
child:SetSize(288, chatWindowHeight)

child.bg = child:CreateTexture(nil, "BACKGROUND")
child.bg:SetAllPoints(true)

local function AddMessageToScrollFrame(message, sender)
    -- Create a new font string for the message
    local newMessage = child:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
    newMessage:SetJustifyH("LEFT")
    
    -- Check the sender and set text color accordingly
    local textColor
    if sender == "Hyrav-LivingFlame" or "Blackjack-ChaosBolt" then
        textColor = {0.961, 0.294, 0.271}
    elseif string.find(message, "Hyrav rolls") then
        textColor = {0.969, 0.969, 0.451}  -- Yellow color for /roll command
    else
        textColor = {0.961, 0.451, 0.208}  -- Default color for other senders
    end

    newMessage:SetTextColor(unpack(textColor))

    -- Replace specific tags with ">>"
    local replacements = {
        ["{square}"] = ">>",
        ["{star}"] = ">>",
        ["{cross}"] = ">>",
        ["{triangle}"] = ">>",
        ["{skull}"] = ">>",
        ["{circle}"] = ">>",
        ["{diamond}"] = ">>",
    }

    for tag, replacement in pairs(replacements) do
        message = string.gsub(message, tag, replacement)
    end

    newMessage:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")

    -- Calculate the maximum width for a line
    local maxWidth = child:GetWidth() - 16  -- Adjusted for left margin (8) and right margin (8)

    -- Split the message into words
    local words = {strsplit(" ", message)}
    local lines = {""}
    local currentLine = 1

    for i, word in ipairs(words) do
        -- Check if adding the word exceeds the maximum width
        local testString = lines[currentLine] == "" and word or lines[currentLine] .. " " .. word
        newMessage:SetText(testString)
        if newMessage:GetWidth() <= maxWidth then
            -- If the word fits, add it to the current line
            lines[currentLine] = testString
        else
            -- If the word exceeds the width, start a new line
            currentLine = currentLine + 1
            lines[currentLine] = word
        end
    end

    -- Position the new message below the previous messages
    for i, line in ipairs(lines) do
        local formattedLine = line

        -- Skip adding "•" for continuation lines
        if i == 1 then
            if string.find(line, ">>") then
                formattedLine = line:gsub("•", "")
            else
                formattedLine = "• " .. line
            end
        end

        newMessage:SetText(formattedLine)
        newMessage:SetPoint("TOPLEFT", 0, -totalHeight)

        -- Update the total height with the height of the new message and spacing
        totalHeight = totalHeight + newMessage:GetHeight() + 1

        -- Set the height of the scroll child
        child:SetHeight(totalHeight)

        -- Calculate the maximum scroll range
        local maxScroll = totalHeight - chatWindowHeight - 10
        maxScroll = math.max(0, maxScroll)  -- Ensure maxScroll is not negative

        -- Set the scroll frame scroll range to the total height
        chatWindowFrame.ScrollFrame:SetVerticalScroll(maxScroll)

        -- Create a new font string for the next line
        newMessage = child:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
        newMessage:SetJustifyH("LEFT")
        newMessage:SetTextColor(unpack(textColor))
        newMessage:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
    end

    -- Always scroll to the bottom to show the latest messages
    chatWindowFrame.ScrollFrame:UpdateScrollChildRect()

    local newValue = chatWindowFrame.ScrollFrame:GetVerticalScrollRange()
    chatWindowFrame.ScrollFrame:SetVerticalScroll(newValue)
end

-- Set the child frame as the scroll child
chatWindowFrame.ScrollFrame:SetScrollChild(child)

chatWindowFrame.ScrollFrame:SetScript("OnMouseWheel", function(self, delta)
    local scrollValue = self:GetVerticalScroll()
    local newValue = scrollValue - (delta * lineHeight)

    if (newValue < 0) then
        newValue = 0
    elseif (newValue > self:GetVerticalScrollRange()) then
        newValue = self:GetVerticalScrollRange()
    end

    self:SetVerticalScroll(newValue)
end)





















-- >> SIDEBET NOTIFICATION WINDOWS <<
-- >> SIDEBET NOTIFICATION WINDOWS <<
-- >> SIDEBET NOTIFICATION WINDOWS <<

-- Creating the PP sideBetWinFrame
sideBetWinFramePP = CreateFrame("Frame", "BlackjackPayoutsFrame", UIParent, "BasicFrameTemplateWithInset")
sideBetWinFramePP:SetSize(325, 180)
sideBetWinFramePP:SetPoint("TOPLEFT", playerFrame, 0, 0)
sideBetWinFramePP:SetFrameStrata("HIGH")
sideBetWinFramePP:SetFrameLevel(7)
sideBetWinFramePP:Hide()

-- Setting a title
sideBetWinFramePP.title = sideBetWinFramePP:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFramePP.title:SetPoint("TOP", sideBetWinFramePP, 0, -5)
sideBetWinFramePP.title:SetText("Side Bet Notification")
sideBetWinFramePP.title:Hide()

sideBetWinFramePP.PPtext = sideBetWinFramePP:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFramePP.PPtext:SetPoint("TOPLEFT", sideBetWinFramePP, 5, -5)
sideBetWinFramePP.PPtext:SetJustifyH("CENTER")
sideBetWinFramePP.PPtext:SetText("PP")
sideBetWinFramePP.PPtext:SetTextColor(1, 0.298, 0.298)
sideBetWinFramePP.PPtext:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFramePP.PPtext:Hide()

sideBetWinFramePP.MixedPairText = sideBetWinFramePP:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFramePP.MixedPairText:SetPoint("TOP", sideBetWinFramePP, 0, -31)
sideBetWinFramePP.MixedPairText:SetJustifyH("CENTER")
sideBetWinFramePP.MixedPairText:SetText("You hit a Mixed Pair!\nPayout is " .. mixedPairPayoutValue ..":1")
sideBetWinFramePP.MixedPairText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFramePP.MixedPairText:Hide()

sideBetWinFramePP.ColouredPairText = sideBetWinFramePP:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFramePP.ColouredPairText:SetPoint("TOP", sideBetWinFramePP, 0, -31)
sideBetWinFramePP.ColouredPairText:SetJustifyH("CENTER")
sideBetWinFramePP.ColouredPairText:SetText("You hit a Coloured Pair!\nPayout is " .. colouredPairPayoutValue ..":1")
sideBetWinFramePP.ColouredPairText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFramePP.ColouredPairText:Hide()

sideBetWinFramePP.PerfectPairText = sideBetWinFramePP:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFramePP.PerfectPairText:SetPoint("TOP", sideBetWinFramePP, 0, -31)
sideBetWinFramePP.PerfectPairText:SetJustifyH("CENTER")
sideBetWinFramePP.PerfectPairText:SetText("You hit a Perfect Pair!\nPayout is " .. perfectPairPayoutValue ..":1")
sideBetWinFramePP.PerfectPairText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFramePP.PerfectPairText:Hide()

sideBetWinFramePP.player1PPCardImage1 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player1PPCardImage1:SetSize(72, 144)
sideBetWinFramePP.player1PPCardImage1:SetPoint("CENTER", sideBetWinFramePP, -40, -23)
sideBetWinFramePP.player1PPCardImage1:SetBlendMode("BLEND")
sideBetWinFramePP.player1PPCardImage1:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player1PPCardImage1:Hide()

sideBetWinFramePP.player1PPCardImage2 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player1PPCardImage2:SetSize(72, 144)
sideBetWinFramePP.player1PPCardImage2:SetPoint("CENTER", sideBetWinFramePP, 40, -23)
sideBetWinFramePP.player1PPCardImage2:SetBlendMode("BLEND")
sideBetWinFramePP.player1PPCardImage2:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player1PPCardImage2:Hide()

sideBetWinFramePP.player2PPCardImage1 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player2PPCardImage1:SetSize(72, 144)
sideBetWinFramePP.player2PPCardImage1:SetPoint("CENTER", sideBetWinFramePP, -40, -23)
sideBetWinFramePP.player2PPCardImage1:SetBlendMode("BLEND")
sideBetWinFramePP.player2PPCardImage1:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player2PPCardImage1:Hide()

sideBetWinFramePP.player2PPCardImage2 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player2PPCardImage2:SetSize(72, 144)
sideBetWinFramePP.player2PPCardImage2:SetPoint("CENTER", sideBetWinFramePP, 40, -23)
sideBetWinFramePP.player2PPCardImage2:SetBlendMode("BLEND")
sideBetWinFramePP.player2PPCardImage2:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player2PPCardImage2:Hide()

sideBetWinFramePP.player3PPCardImage1 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player3PPCardImage1:SetSize(72, 144)
sideBetWinFramePP.player3PPCardImage1:SetPoint("CENTER", sideBetWinFramePP, -40, -23)
sideBetWinFramePP.player3PPCardImage1:SetBlendMode("BLEND")
sideBetWinFramePP.player3PPCardImage1:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player3PPCardImage1:Hide()

sideBetWinFramePP.player3PPCardImage2 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player3PPCardImage2:SetSize(72, 144)
sideBetWinFramePP.player3PPCardImage2:SetPoint("CENTER", sideBetWinFramePP, 40, -23)
sideBetWinFramePP.player3PPCardImage2:SetBlendMode("BLEND")
sideBetWinFramePP.player3PPCardImage2:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player3PPCardImage2:Hide()

sideBetWinFramePP.player4PPCardImage1 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player4PPCardImage1:SetSize(72, 144)
sideBetWinFramePP.player4PPCardImage1:SetPoint("CENTER", sideBetWinFramePP, -40, -23)
sideBetWinFramePP.player4PPCardImage1:SetBlendMode("BLEND")
sideBetWinFramePP.player4PPCardImage1:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player4PPCardImage1:Hide()

sideBetWinFramePP.player4PPCardImage2 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player4PPCardImage2:SetSize(72, 144)
sideBetWinFramePP.player4PPCardImage2:SetPoint("CENTER", sideBetWinFramePP, 40, -23)
sideBetWinFramePP.player4PPCardImage2:SetBlendMode("BLEND")
sideBetWinFramePP.player4PPCardImage2:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player4PPCardImage2:Hide()

sideBetWinFramePP.player5PPCardImage1 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player5PPCardImage1:SetSize(72, 144)
sideBetWinFramePP.player5PPCardImage1:SetPoint("CENTER", sideBetWinFramePP, -40, -23)
sideBetWinFramePP.player5PPCardImage1:SetBlendMode("BLEND")
sideBetWinFramePP.player5PPCardImage1:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player5PPCardImage1:Hide()

sideBetWinFramePP.player5PPCardImage2 = sideBetWinFramePP:CreateTexture(nil, "OVERLAY")
sideBetWinFramePP.player5PPCardImage2:SetSize(72, 144)
sideBetWinFramePP.player5PPCardImage2:SetPoint("CENTER", sideBetWinFramePP, 40, -23)
sideBetWinFramePP.player5PPCardImage2:SetBlendMode("BLEND")
sideBetWinFramePP.player5PPCardImage2:SetDrawLayer("ARTWORK")
sideBetWinFramePP.player5PPCardImage2:Hide()

-- Creating the 21+3 sideBetWinFrame
sideBetWinFrame213 = CreateFrame("Frame", "BlackjackPayoutsFrame", UIParent, "BasicFrameTemplateWithInset")
sideBetWinFrame213:SetSize(325, 180)
sideBetWinFrame213:SetPoint("TOPLEFT", playerFrame, 0, -180)
sideBetWinFrame213:SetFrameStrata("HIGH")
sideBetWinFrame213:SetFrameLevel(7)
sideBetWinFrame213:Hide()

-- Setting a title
sideBetWinFrame213.title = sideBetWinFrame213:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFrame213.title:SetPoint("TOP", sideBetWinFrame213, 0, -5)
sideBetWinFrame213.title:SetText("Side Bet Notification")
sideBetWinFrame213.title:Hide()

sideBetWinFrame213.t213text = sideBetWinFrame213:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFrame213.t213text:SetPoint("TOPLEFT", sideBetWinFrame213, 5, -5)
sideBetWinFrame213.t213text:SetJustifyH("CENTER")
sideBetWinFrame213.t213text:SetText("21+3")
sideBetWinFrame213.t213text:SetTextColor(1, 0.298, 0.298)
sideBetWinFrame213.t213text:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFrame213.t213text:Hide()

sideBetWinFrame213.FlushText = sideBetWinFrame213:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFrame213.FlushText:SetPoint("TOP", sideBetWinFrame213, 0, -31)
sideBetWinFrame213.FlushText:SetJustifyH("CENTER")
sideBetWinFrame213.FlushText:SetText("You hit a Flush!\nPayout is " .. flushPayoutValue ..":1")
sideBetWinFrame213.FlushText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFrame213.FlushText:Hide()

sideBetWinFrame213.StraightText = sideBetWinFrame213:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFrame213.StraightText:SetPoint("TOP", sideBetWinFrame213, 0, -31)
sideBetWinFrame213.StraightText:SetJustifyH("CENTER")
sideBetWinFrame213.StraightText:SetText("You hit a Straight!\nPayout is " .. straightPayoutValue ..":1")
sideBetWinFrame213.StraightText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFrame213.StraightText:Hide()

sideBetWinFrame213.ThreeOfAKindText = sideBetWinFrame213:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFrame213.ThreeOfAKindText:SetPoint("TOP", sideBetWinFrame213, 0, -31)
sideBetWinFrame213.ThreeOfAKindText:SetJustifyH("CENTER")
sideBetWinFrame213.ThreeOfAKindText:SetText("You hit a Three of a Kind!\nPayout is " .. threeOfAKindPayoutValue ..":1")
sideBetWinFrame213.ThreeOfAKindText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFrame213.ThreeOfAKindText:Hide()

sideBetWinFrame213.StraightFlushText = sideBetWinFrame213:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFrame213.StraightFlushText:SetPoint("TOP", sideBetWinFrame213, 0, -31)
sideBetWinFrame213.StraightFlushText:SetJustifyH("CENTER")
sideBetWinFrame213.StraightFlushText:SetText("You hit a Straight Flush!\nPayout is " .. straightFlushPayoutValue ..":1")
sideBetWinFrame213.StraightFlushText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFrame213.StraightFlushText:Hide()

sideBetWinFrame213.SuitedThreeOfAKindText = sideBetWinFrame213:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
sideBetWinFrame213.SuitedThreeOfAKindText:SetPoint("TOP", sideBetWinFrame213, 0, -31)
sideBetWinFrame213.SuitedThreeOfAKindText:SetJustifyH("CENTER")
sideBetWinFrame213.SuitedThreeOfAKindText:SetText("You hit a Suited Three of a Kind!\nPayout is " .. suitedThreeOfAKindPayoutValue ..":1")
sideBetWinFrame213.SuitedThreeOfAKindText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
sideBetWinFrame213.SuitedThreeOfAKindText:Hide()

sideBetWinFrame213.dealer213CardImage1 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.dealer213CardImage1:SetSize(72, 144)
sideBetWinFrame213.dealer213CardImage1:SetPoint("CENTER", sideBetWinFrame213, 100, -23)
sideBetWinFrame213.dealer213CardImage1:SetBlendMode("BLEND")
sideBetWinFrame213.dealer213CardImage1:SetDrawLayer("ARTWORK")
sideBetWinFrame213.dealer213CardImage1:Hide()

sideBetWinFrame213.player1213CardImage1 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player1213CardImage1:SetSize(72, 144)
sideBetWinFrame213.player1213CardImage1:SetPoint("CENTER", sideBetWinFrame213, -100, -23)
sideBetWinFrame213.player1213CardImage1:SetBlendMode("BLEND")
sideBetWinFrame213.player1213CardImage1:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player1213CardImage1:Hide()

sideBetWinFrame213.player1213CardImage2 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player1213CardImage2:SetSize(72, 144)
sideBetWinFrame213.player1213CardImage2:SetPoint("CENTER", sideBetWinFrame213, -20, -23)
sideBetWinFrame213.player1213CardImage2:SetBlendMode("BLEND")
sideBetWinFrame213.player1213CardImage2:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player1213CardImage2:Hide()

sideBetWinFrame213.player2213CardImage1 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player2213CardImage1:SetSize(72, 144)
sideBetWinFrame213.player2213CardImage1:SetPoint("CENTER", sideBetWinFrame213, -100, -23)
sideBetWinFrame213.player2213CardImage1:SetBlendMode("BLEND")
sideBetWinFrame213.player2213CardImage1:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player2213CardImage1:Hide()

sideBetWinFrame213.player2213CardImage2 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player2213CardImage2:SetSize(72, 144)
sideBetWinFrame213.player2213CardImage2:SetPoint("CENTER", sideBetWinFrame213, -20, -23)
sideBetWinFrame213.player2213CardImage2:SetBlendMode("BLEND")
sideBetWinFrame213.player2213CardImage2:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player2213CardImage2:Hide()

sideBetWinFrame213.player3213CardImage1 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player3213CardImage1:SetSize(72, 144)
sideBetWinFrame213.player3213CardImage1:SetPoint("CENTER", sideBetWinFrame213, -100, -23)
sideBetWinFrame213.player3213CardImage1:SetBlendMode("BLEND")
sideBetWinFrame213.player3213CardImage1:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player3213CardImage1:Hide()

sideBetWinFrame213.player3213CardImage2 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player3213CardImage2:SetSize(72, 144)
sideBetWinFrame213.player3213CardImage2:SetPoint("CENTER", sideBetWinFrame213, -20, -23)
sideBetWinFrame213.player3213CardImage2:SetBlendMode("BLEND")
sideBetWinFrame213.player3213CardImage2:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player3213CardImage2:Hide()

sideBetWinFrame213.player4213CardImage1 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player4213CardImage1:SetSize(72, 144)
sideBetWinFrame213.player4213CardImage1:SetPoint("CENTER", sideBetWinFrame213, -100, -23)
sideBetWinFrame213.player4213CardImage1:SetBlendMode("BLEND")
sideBetWinFrame213.player4213CardImage1:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player4213CardImage1:Hide()

sideBetWinFrame213.player4213CardImage2 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player4213CardImage2:SetSize(72, 144)
sideBetWinFrame213.player4213CardImage2:SetPoint("CENTER", sideBetWinFrame213, -20, -23)
sideBetWinFrame213.player4213CardImage2:SetBlendMode("BLEND")
sideBetWinFrame213.player4213CardImage2:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player4213CardImage2:Hide()

sideBetWinFrame213.player5213CardImage1 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player5213CardImage1:SetSize(72, 144)
sideBetWinFrame213.player5213CardImage1:SetPoint("CENTER", sideBetWinFrame213, -100, -23)
sideBetWinFrame213.player5213CardImage1:SetBlendMode("BLEND")
sideBetWinFrame213.player5213CardImage1:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player5213CardImage1:Hide()

sideBetWinFrame213.player5213CardImage2 = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.player5213CardImage2:SetSize(72, 144)
sideBetWinFrame213.player5213CardImage2:SetPoint("CENTER", sideBetWinFrame213, -20, -23)
sideBetWinFrame213.player5213CardImage2:SetBlendMode("BLEND")
sideBetWinFrame213.player5213CardImage2:SetDrawLayer("ARTWORK")
sideBetWinFrame213.player5213CardImage2:Hide()

sideBetWinFrame213.PlusSymbol = sideBetWinFrame213:CreateTexture(nil, "OVERLAY")
sideBetWinFrame213.PlusSymbol:SetSize(32, 32)
sideBetWinFrame213.PlusSymbol:SetPoint("CENTER", sideBetWinFrame213, 40, -23)
sideBetWinFrame213.PlusSymbol:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\PlusSymbol.tga")
sideBetWinFrame213.PlusSymbol:SetBlendMode("BLEND")
sideBetWinFrame213.PlusSymbol:SetDrawLayer("ARTWORK")
sideBetWinFrame213.PlusSymbol:Hide()

function player1MixedPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.MixedPairText:Show()
    sideBetWinFramePP.player1PPCardImage1:Show()
    sideBetWinFramePP.player1PPCardImage2:Show()
end
function player1ColouredPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.ColouredPairText:Show()
    sideBetWinFramePP.player1PPCardImage1:Show()
    sideBetWinFramePP.player1PPCardImage2:Show()
end
function player1PerfectPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.PerfectPairText:Show()
    sideBetWinFramePP.player1PPCardImage1:Show()
    sideBetWinFramePP.player1PPCardImage2:Show()
end
function player1SuitedThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.SuitedThreeOfAKindText:Show()
    sideBetWinFrame213.player1213CardImage1:Show()
    sideBetWinFrame213.player1213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player1StraightFlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightFlushText:Show()
    sideBetWinFrame213.player1213CardImage1:Show()
    sideBetWinFrame213.player1213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player1ThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.ThreeOfAKindText:Show()
    sideBetWinFrame213.player1213CardImage1:Show()
    sideBetWinFrame213.player1213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player1StraightNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightText:Show()
    sideBetWinFrame213.player1213CardImage1:Show()
    sideBetWinFrame213.player1213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player1FlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.FlushText:Show()
    sideBetWinFrame213.player1213CardImage1:Show()
    sideBetWinFrame213.player1213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end



function player2MixedPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.MixedPairText:Show()
    sideBetWinFramePP.player2PPCardImage1:Show()
    sideBetWinFramePP.player2PPCardImage2:Show()
end
function player2ColouredPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.ColouredPairText:Show()
    sideBetWinFramePP.player2PPCardImage1:Show()
    sideBetWinFramePP.player2PPCardImage2:Show()
end
function player2PerfectPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.PerfectPairText:Show()
    sideBetWinFramePP.player2PPCardImage1:Show()
    sideBetWinFramePP.player2PPCardImage2:Show()
end
function player2SuitedThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.SuitedThreeOfAKindText:Show()
    sideBetWinFrame213.player2213CardImage1:Show()
    sideBetWinFrame213.player2213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player2StraightFlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightFlushText:Show()
    sideBetWinFrame213.player2213CardImage1:Show()
    sideBetWinFrame213.player2213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player2ThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.ThreeOfAKindText:Show()
    sideBetWinFrame213.player2213CardImage1:Show()
    sideBetWinFrame213.player2213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player2StraightNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightText:Show()
    sideBetWinFrame213.player2213CardImage1:Show()
    sideBetWinFrame213.player2213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player2FlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.FlushText:Show()
    sideBetWinFrame213.player2213CardImage1:Show()
    sideBetWinFrame213.player2213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end



function player3MixedPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.MixedPairText:Show()
    sideBetWinFramePP.player3PPCardImage1:Show()
    sideBetWinFramePP.player3PPCardImage2:Show()
end
function player3ColouredPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.ColouredPairText:Show()
    sideBetWinFramePP.player3PPCardImage1:Show()
    sideBetWinFramePP.player3PPCardImage2:Show()
end
function player3PerfectPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.PerfectPairText:Show()
    sideBetWinFramePP.player3PPCardImage1:Show()
    sideBetWinFramePP.player3PPCardImage2:Show()
end
function player3SuitedThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.SuitedThreeOfAKindText:Show()
    sideBetWinFrame213.player3213CardImage1:Show()
    sideBetWinFrame213.player3213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player3StraightFlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightFlushText:Show()
    sideBetWinFrame213.player3213CardImage1:Show()
    sideBetWinFrame213.player3213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player3ThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.ThreeOfAKindText:Show()
    sideBetWinFrame213.player3213CardImage1:Show()
    sideBetWinFrame213.player3213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player3StraightNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightText:Show()
    sideBetWinFrame213.player3213CardImage1:Show()
    sideBetWinFrame213.player3213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player3FlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.FlushText:Show()
    sideBetWinFrame213.player3213CardImage1:Show()
    sideBetWinFrame213.player3213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end



function player4MixedPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.MixedPairText:Show()
    sideBetWinFramePP.player4PPCardImage1:Show()
    sideBetWinFramePP.player4PPCardImage2:Show()
end
function player4ColouredPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.ColouredPairText:Show()
    sideBetWinFramePP.player4PPCardImage1:Show()
    sideBetWinFramePP.player4PPCardImage2:Show()
end
function player4PerfectPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.PerfectPairText:Show()
    sideBetWinFramePP.player4PPCardImage1:Show()
    sideBetWinFramePP.player4PPCardImage2:Show()
end
function player4SuitedThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.SuitedThreeOfAKindText:Show()
    sideBetWinFrame213.player4213CardImage1:Show()
    sideBetWinFrame213.player4213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player4StraightFlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightFlushText:Show()
    sideBetWinFrame213.player4213CardImage1:Show()
    sideBetWinFrame213.player4213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player4ThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.ThreeOfAKindText:Show()
    sideBetWinFrame213.player4213CardImage1:Show()
    sideBetWinFrame213.player4213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player4StraightNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightText:Show()
    sideBetWinFrame213.player4213CardImage1:Show()
    sideBetWinFrame213.player4213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player4FlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.FlushText:Show()
    sideBetWinFrame213.player4213CardImage1:Show()
    sideBetWinFrame213.player4213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end



function player5MixedPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.MixedPairText:Show()
    sideBetWinFramePP.player5PPCardImage1:Show()
    sideBetWinFramePP.player5PPCardImage2:Show()
end
function player5ColouredPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.ColouredPairText:Show()
    sideBetWinFramePP.player5PPCardImage1:Show()
    sideBetWinFramePP.player5PPCardImage2:Show()
end
function player5PerfectPairNotification()
    sideBetWinFramePP:Show()
    sideBetWinFramePP.title:Show()
    sideBetWinFramePP.PPtext:Show()
    sideBetWinFramePP.PerfectPairText:Show()
    sideBetWinFramePP.player5PPCardImage1:Show()
    sideBetWinFramePP.player5PPCardImage2:Show()
end
function player5SuitedThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.SuitedThreeOfAKindText:Show()
    sideBetWinFrame213.player5213CardImage1:Show()
    sideBetWinFrame213.player5213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player5StraightFlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightFlushText:Show()
    sideBetWinFrame213.player5213CardImage1:Show()
    sideBetWinFrame213.player5213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player5ThreeOfAKindNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.ThreeOfAKindText:Show()
    sideBetWinFrame213.player5213CardImage1:Show()
    sideBetWinFrame213.player5213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player5StraightNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.StraightText:Show()
    sideBetWinFrame213.player5213CardImage1:Show()
    sideBetWinFrame213.player5213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end
function player5FlushNotification()

    sideBetWinFrame213:Show()
    sideBetWinFrame213.title:Show()
    sideBetWinFrame213.t213text:Show()
    sideBetWinFrame213.FlushText:Show()
    sideBetWinFrame213.player5213CardImage1:Show()
    sideBetWinFrame213.player5213CardImage2:Show()
    sideBetWinFrame213.dealer213CardImage1:Show()
    sideBetWinFrame213.PlusSymbol:Show()

end










playerFrame:SetScript("OnHide", function(self)
    PlaySoundFile(soundFilePaths[117])
    bankrollFrame:Hide()
    preloadFrame:Hide()
    historyFrame:Hide()
    rulesFrame:Hide()
    payoutsFrame:Hide()
    sideBetWinFramePP:Hide()
    sideBetWinFrame213:Hide()
    player1dealtCardsFrame:Hide()
    player1dealtCardsFrameSplitH1:Hide()
    player1dealtCardsFrameSplitH2:Hide()
    player2dealtCardsFrame:Hide()
    player2dealtCardsFrameSplitH1:Hide()
    player2dealtCardsFrameSplitH2:Hide()
    player3dealtCardsFrame:Hide()
    player3dealtCardsFrameSplitH1:Hide()
    player3dealtCardsFrameSplitH2:Hide()
    player4dealtCardsFrame:Hide()
    player4dealtCardsFrameSplitH1:Hide()
    player4dealtCardsFrameSplitH2:Hide()
    player5dealtCardsFrame:Hide()
    player5dealtCardsFrameSplitH1:Hide()
    player5dealtCardsFrameSplitH2:Hide()
    chatWindowFrame:Hide()

    if playerName == unitName1 then
        playerFrame.leaveSeat1Button:Hide()
        playerFrame.player1HitButton:Hide()
        playerFrame.player1StandButton:Hide()
        playerFrame.player1DoubleButton:Hide()
        playerFrame.player1SplitButton:Hide()
        playerFrame.player1InsuranceYesButton:Hide()
        playerFrame.player1InsuranceNoButton:Hide()
        player1ConfirmMainBetButton:Hide()
        player1ConfirmPPBetButton:Hide()
        player1Confirm213BetButton:Hide()
        player1MainBetEditBox:Hide()
        player1PPBetEditBox:Hide()
        player1213BetEditBox:Hide()
        playerFrame.player1MainBetTitle:Hide()
        playerFrame.player1PPBetTitle:Hide()
        playerFrame.player1213BetTitle:Hide()
        playerFrame.player1InsuranceTitle:Hide()
        playerFrame.player1InsuranceSubtitle:Hide()
        menuFrame.cardsButton:Disable()
        playerFrame.historyButton:Disable()
        menuFrame.preloadButton:Disable()
        playerFrame.cashDeskButton:Disable()
        bankrollFrame.player1TotalBankrollTableDisplay:Hide()
        bankrollFrame.BaseTextDisplay:Show()
        cashDeskFrame.player1TotalBankroll:Hide()
        if gameRunning == false then
            playerFrame.player1Name:SetText("Seat Empty")
            SendChatMessage("{circle} " .. playerName .. " has left the table.", "RAID")
        else
            SendChatMessage("{skull} " .. playerName .. " exited the table before the round finished.", "RAID")
        end
        playerFrame.takeSeat1Button:Show()
        playerFrame.takeSeat1Button:Enable()
        if playerFrame.player2Name:GetText() == "Seat Empty" then    
            playerFrame.takeSeat2Button:Enable()
        end
        if playerFrame.player3Name:GetText() == "Seat Empty" then  
            playerFrame.takeSeat3Button:Enable()
        end
        if playerFrame.player4Name:GetText() == "Seat Empty" then 
            playerFrame.takeSeat4Button:Enable()
        end
        if playerFrame.player5Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat5Button:Enable()
        end
    elseif playerName == unitName2 then
        playerFrame.leaveSeat2Button:Hide()
        playerFrame.player2HitButton:Hide()
        playerFrame.player2StandButton:Hide()
        playerFrame.player2DoubleButton:Hide()
        playerFrame.player2SplitButton:Hide()
        playerFrame.player2InsuranceYesButton:Hide()
        playerFrame.player2InsuranceNoButton:Hide()
        player2ConfirmMainBetButton:Hide()
        player2ConfirmPPBetButton:Hide()
        player2Confirm213BetButton:Hide()
        player2MainBetEditBox:Hide()
        player2PPBetEditBox:Hide()
        player2213BetEditBox:Hide()
        playerFrame.player2MainBetTitle:Hide()
        playerFrame.player2PPBetTitle:Hide()
        playerFrame.player2213BetTitle:Hide()
        playerFrame.player2InsuranceTitle:Hide()
        playerFrame.player2InsuranceSubtitle:Hide()
        menuFrame.cardsButton:Disable()
        playerFrame.historyButton:Disable()
        menuFrame.preloadButton:Disable()
        playerFrame.cashDeskButton:Disable()
        bankrollFrame.player2TotalBankrollTableDisplay:Hide()
        bankrollFrame.BaseTextDisplay:Show()
        cashDeskFrame.player2TotalBankroll:Hide()
        if gameRunning == false then
            playerFrame.player2Name:SetText("Seat Empty")
            SendChatMessage("{circle} " .. playerName .. " has left the table.", "RAID")
        else
            SendChatMessage("{skull} " .. playerName .. " exited the table before the round finished.", "RAID")
        end
        playerFrame.takeSeat2Button:Show()
        playerFrame.takeSeat2Button:Enable()
        if playerFrame.player1Name:GetText() == "Seat Empty" then    
            playerFrame.takeSeat1Button:Enable()
        end
        if playerFrame.player3Name:GetText() == "Seat Empty" then  
            playerFrame.takeSeat3Button:Enable()
        end
        if playerFrame.player4Name:GetText() == "Seat Empty" then 
            playerFrame.takeSeat4Button:Enable()
        end
        if playerFrame.player5Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat5Button:Enable()
        end
    elseif playerName == unitName3 then
        playerFrame.leaveSeat3Button:Hide()
        playerFrame.player3HitButton:Hide()
        playerFrame.player3StandButton:Hide()
        playerFrame.player3DoubleButton:Hide()
        playerFrame.player3SplitButton:Hide()
        playerFrame.player3InsuranceYesButton:Hide()
        playerFrame.player3InsuranceNoButton:Hide()
        player3ConfirmMainBetButton:Hide()
        player3ConfirmPPBetButton:Hide()
        player3Confirm213BetButton:Hide()
        player3MainBetEditBox:Hide()
        player3PPBetEditBox:Hide()
        player3213BetEditBox:Hide()
        playerFrame.player3MainBetTitle:Hide()
        playerFrame.player3PPBetTitle:Hide()
        playerFrame.player3213BetTitle:Hide()
        playerFrame.player3InsuranceTitle:Hide()
        playerFrame.player3InsuranceSubtitle:Hide()
        menuFrame.cardsButton:Disable()
        playerFrame.historyButton:Disable()
        menuFrame.preloadButton:Disable()
        playerFrame.cashDeskButton:Disable()
        bankrollFrame.player3TotalBankrollTableDisplay:Hide()
        bankrollFrame.BaseTextDisplay:Show()
        cashDeskFrame.player3TotalBankroll:Hide()
        if gameRunning == false then
            playerFrame.player3Name:SetText("Seat Empty")
            SendChatMessage("{circle} " .. playerName .. " has left the table.", "RAID")
        else
            SendChatMessage("{skull} " .. playerName .. " exited the table before the round finished.", "RAID")
        end
        playerFrame.takeSeat3Button:Show()
        playerFrame.takeSeat3Button:Enable()
        if playerFrame.player1Name:GetText() == "Seat Empty" then    
            playerFrame.takeSeat1Button:Enable()
        end
        if playerFrame.player2Name:GetText() == "Seat Empty" then  
            playerFrame.takeSeat2Button:Enable()
        end
        if playerFrame.player4Name:GetText() == "Seat Empty" then 
            playerFrame.takeSeat4Button:Enable()
        end
        if playerFrame.player5Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat5Button:Enable()
        end
    elseif playerName == unitName4 then
        playerFrame.leaveSeat4Button:Hide()
        playerFrame.player4HitButton:Hide()
        playerFrame.player4StandButton:Hide()
        playerFrame.player4DoubleButton:Hide()
        playerFrame.player4SplitButton:Hide()
        playerFrame.player4InsuranceYesButton:Hide()
        playerFrame.player4InsuranceNoButton:Hide()
        player4ConfirmMainBetButton:Hide()
        player4ConfirmPPBetButton:Hide()
        player4Confirm213BetButton:Hide()
        player4MainBetEditBox:Hide()
        player4PPBetEditBox:Hide()
        player4213BetEditBox:Hide()
        playerFrame.player4MainBetTitle:Hide()
        playerFrame.player4PPBetTitle:Hide()
        playerFrame.player4213BetTitle:Hide()
        playerFrame.player4InsuranceTitle:Hide()
        playerFrame.player4InsuranceSubtitle:Hide()
        menuFrame.cardsButton:Disable()
        playerFrame.historyButton:Disable()
        menuFrame.preloadButton:Disable()
        playerFrame.cashDeskButton:Disable()
        bankrollFrame.player4TotalBankrollTableDisplay:Hide()
        bankrollFrame.BaseTextDisplay:Show()
        cashDeskFrame.player4TotalBankroll:Hide()
        if gameRunning == false then
            playerFrame.player4Name:SetText("Seat Empty")
            SendChatMessage("{circle} " .. playerName .. " has left the table.", "RAID")
        else
            SendChatMessage("{skull} " .. playerName .. " exited the table before the round finished.", "RAID")
        end
        playerFrame.takeSeat4Button:Show()
        playerFrame.takeSeat4Button:Enable()
        if playerFrame.player1Name:GetText() == "Seat Empty" then    
            playerFrame.takeSeat1Button:Enable()
        end
        if playerFrame.player2Name:GetText() == "Seat Empty" then  
            playerFrame.takeSeat2Button:Enable()
        end
        if playerFrame.player3Name:GetText() == "Seat Empty" then 
            playerFrame.takeSeat3Button:Enable()
        end
        if playerFrame.player5Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat5Button:Enable()
        end
    elseif playerName == unitName5 then
        playerFrame.leaveSeat5Button:Hide()
        playerFrame.player5HitButton:Hide()
        playerFrame.player5StandButton:Hide()
        playerFrame.player5DoubleButton:Hide()
        playerFrame.player5SplitButton:Hide()
        playerFrame.player5InsuranceYesButton:Hide()
        playerFrame.player5InsuranceNoButton:Hide()
        player5ConfirmMainBetButton:Hide()
        player5ConfirmPPBetButton:Hide()
        player5Confirm213BetButton:Hide()
        player5MainBetEditBox:Hide()
        player5PPBetEditBox:Hide()
        player5213BetEditBox:Hide()
        playerFrame.player5MainBetTitle:Hide()
        playerFrame.player5PPBetTitle:Hide()
        playerFrame.player5213BetTitle:Hide()
        playerFrame.player5InsuranceTitle:Hide()
        playerFrame.player5InsuranceSubtitle:Hide()
        menuFrame.cardsButton:Disable()
        playerFrame.historyButton:Disable()
        menuFrame.preloadButton:Disable()
        playerFrame.cashDeskButton:Disable()
        bankrollFrame.player5TotalBankrollTableDisplay:Hide()
        bankrollFrame.BaseTextDisplay:Show()
        cashDeskFrame.player5TotalBankroll:Hide()
        if gameRunning == false then
            playerFrame.player5Name:SetText("Seat Empty")
            SendChatMessage("{circle} " .. playerName .. " has left the table.", "RAID")
        else
            SendChatMessage("{skull} " .. playerName .. " exited the table before the round finished.", "RAID")
        end
        playerFrame.takeSeat5Button:Show()
        playerFrame.takeSeat5Button:Enable()
        if playerFrame.player1Name:GetText() == "Seat Empty" then    
            playerFrame.takeSeat1Button:Enable()
        end
        if playerFrame.player2Name:GetText() == "Seat Empty" then  
            playerFrame.takeSeat2Button:Enable()
        end
        if playerFrame.player3Name:GetText() == "Seat Empty" then 
            playerFrame.takeSeat3Button:Enable()
        end
        if playerFrame.player4Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat4Button:Enable()
        end
    end
end)
function resetHistory()

    -- >>> PLAYER 1 <<<
    -- >>> PLAYER 1 <<<
    player1totalBetAmount = 0
    historyFrame.player1totalWageredAmount:SetText("0 G")
    player1totalWin = 0
    historyFrame.player1totalWonAmount:SetText("0 G")
    player1totalLoss = 0
    historyFrame.player1totalLostAmount:SetText("0 G")
    player1totalProfit = 0
    historyFrame.player1ProfitAmount:SetText("0 G")
    historyFrame.player1ProfitAmount:SetTextColor(1, 1, 1)
    player1TotalBankrollAmount = 0


    -- >>> PLAYER 2 <<<
    -- >>> PLAYER 2 <<<
    player2totalBetAmount = 0
    historyFrame.player2totalWageredAmount:SetText("0 G")
    player2totalWin = 0
    historyFrame.player2totalWonAmount:SetText("0 G")
    player2totalLoss = 0
    historyFrame.player2totalLostAmount:SetText("0 G")
    player2totalProfit = 0
    historyFrame.player2ProfitAmount:SetText("0 G")
    historyFrame.player2ProfitAmount:SetTextColor(1, 1, 1)
    player2TotalBankrollAmount = 0


    -- >>> PLAYER 3 <<<
    -- >>> PLAYER 3 <<<
    player3totalBetAmount = 0
    historyFrame.player3totalWageredAmount:SetText("0 G")
    player3totalWin = 0
    historyFrame.player3totalWonAmount:SetText("0 G")
    player3totalLoss = 0
    historyFrame.player3totalLostAmount:SetText("0 G")
    player3totalProfit = 0
    historyFrame.player3ProfitAmount:SetText("0 G")
    historyFrame.player3ProfitAmount:SetTextColor(1, 1, 1)
    player3TotalBankrollAmount = 0


    -- >>> PLAYER 4 <<<
    -- >>> PLAYER 4 <<<
    player4totalBetAmount = 0
    historyFrame.player4totalWageredAmount:SetText("0 G")
    player4totalWin = 0
    historyFrame.player4totalWonAmount:SetText("0 G")
    player4totalLoss = 0
    historyFrame.player4totalLostAmount:SetText("0 G")
    player4totalProfit = 0
    historyFrame.player4ProfitAmount:SetText("0 G")
    historyFrame.player4ProfitAmount:SetTextColor(1, 1, 1)
    player4TotalBankrollAmount = 0


    -- >>> PLAYER 5 <<<
    -- >>> PLAYER 5 <<<
    player5totalBetAmount = 0
    historyFrame.player5totalWageredAmount:SetText("0 G")
    player5totalWin = 0
    historyFrame.player5totalWonAmount:SetText("0 G")
    player5totalLoss = 0
    historyFrame.player5totalLostAmount:SetText("0 G")
    player5totalProfit = 0
    historyFrame.player5ProfitAmount:SetText("0 G")
    historyFrame.player5ProfitAmount:SetTextColor(1, 1, 1)
    player5TotalBankrollAmount = 0

end
local function PlayerFrameHide()
    playerFrame:Hide()
    historyFrame:Hide()
    rulesFrame:Hide()
    preloadFrame:Hide()
    payoutsFrame:Hide()
    sideBetWinFramePP:Hide()
    initialFrame.joinButton:Disable()
    cashDeskFrame.returnButton:Disable()
    initialFrame:Show()
end


















-- >>> PLAYER 1 <<<
-- >>> PLAYER 1 <<<
-- >>> PLAYER 1 <<<

playerFrame.player1CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 385, 368)
playerFrame.player1CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 28, "OUTLINE")
playerFrame.player1CardTotalText:SetText("")

playerFrame.player1SplitHand1CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1SplitHand1CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 410, 395)
playerFrame.player1SplitHand1CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player1SplitHand1CardTotalText:SetText("")

playerFrame.player1SplitHand2CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1SplitHand2CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 372, 355)
playerFrame.player1SplitHand2CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player1SplitHand2CardTotalText:SetText("")

-- Buttons for Player 1
-- Hit
playerFrame.player1HitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1HitButton:SetPoint("BOTTOM", playerFrame, 419, 275)
playerFrame.player1HitButton:SetSize(65, 30)
playerFrame.player1HitButton:SetText("Hit")
playerFrame.player1HitButton:Disable()
playerFrame.player1HitButton:Hide()
-- Stand
playerFrame.player1StandButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1StandButton:SetPoint("BOTTOM", playerFrame, 485, 275)
playerFrame.player1StandButton:SetSize(65, 30)
playerFrame.player1StandButton:SetText("Stand")
playerFrame.player1StandButton:Disable()
playerFrame.player1StandButton:Hide()
-- Double
playerFrame.player1DoubleButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1DoubleButton:SetPoint("BOTTOM", playerFrame, 419, 245)
playerFrame.player1DoubleButton:SetSize(65, 30)
playerFrame.player1DoubleButton:SetText("Double")
playerFrame.player1DoubleButton:Disable()
playerFrame.player1DoubleButton:Hide()
-- Split
playerFrame.player1SplitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1SplitButton:SetPoint("BOTTOM", playerFrame, 485, 245)
playerFrame.player1SplitButton:SetSize(65, 30)
playerFrame.player1SplitButton:SetText("Split")
playerFrame.player1SplitButton:Disable()
playerFrame.player1SplitButton:Hide()
-- Insurance Yes
playerFrame.player1InsuranceYesButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1InsuranceYesButton:SetPoint("BOTTOM", playerFrame, 387, 215)
playerFrame.player1InsuranceYesButton:SetSize(55, 30)
playerFrame.player1InsuranceYesButton:SetText("Yes")
playerFrame.player1InsuranceYesButton:Disable()
playerFrame.player1InsuranceYesButton:Hide()
-- Insurance No
playerFrame.player1InsuranceNoButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1InsuranceNoButton:SetPoint("BOTTOM", playerFrame, 515, 215)
playerFrame.player1InsuranceNoButton:SetSize(55, 30)
playerFrame.player1InsuranceNoButton:SetText("No")
playerFrame.player1InsuranceNoButton:Disable()
playerFrame.player1InsuranceNoButton:Hide()
-- Deal Now
playerFrame.player1DealNowButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1DealNowButton:SetPoint("BOTTOM", playerFrame, 452, 215)
playerFrame.player1DealNowButton:SetSize(85, 30)
playerFrame.player1DealNowButton:SetText("Deal Now")
playerFrame.player1DealNowButton:Disable()
playerFrame.player1DealNowButton:Hide()
-- Hit (Split H1)
playerFrame.player1HitButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1HitButtonSplitH1:SetPoint("BOTTOM", playerFrame, 485, 275)
playerFrame.player1HitButtonSplitH1:SetSize(65, 30)
playerFrame.player1HitButtonSplitH1:SetText("Hit")
playerFrame.player1HitButtonSplitH1:Disable()
playerFrame.player1HitButtonSplitH1:Hide()
-- Stand (Split H1)
playerFrame.player1StandButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1StandButtonSplitH1:SetPoint("BOTTOM", playerFrame, 485, 245)
playerFrame.player1StandButtonSplitH1:SetSize(65, 30)
playerFrame.player1StandButtonSplitH1:SetText("Stand")
playerFrame.player1StandButtonSplitH1:Disable()
playerFrame.player1StandButtonSplitH1:Hide()
-- Double (Split H1)
playerFrame.player1DoubleButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1DoubleButtonSplitH1:SetPoint("BOTTOM", playerFrame, 485, 215)
playerFrame.player1DoubleButtonSplitH1:SetSize(65, 30)
playerFrame.player1DoubleButtonSplitH1:SetText("Double")
playerFrame.player1DoubleButtonSplitH1:Disable()
playerFrame.player1DoubleButtonSplitH1:Hide()
-- Hit (Split H2)
playerFrame.player1HitButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1HitButtonSplitH2:SetPoint("BOTTOM", playerFrame, 419, 275)
playerFrame.player1HitButtonSplitH2:SetSize(65, 30)
playerFrame.player1HitButtonSplitH2:SetText("Hit")
playerFrame.player1HitButtonSplitH2:Disable()
playerFrame.player1HitButtonSplitH2:Hide()
-- Stand (Split H2)
playerFrame.player1StandButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1StandButtonSplitH2:SetPoint("BOTTOM", playerFrame, 419, 245)
playerFrame.player1StandButtonSplitH2:SetSize(65, 30)
playerFrame.player1StandButtonSplitH2:SetText("Stand")
playerFrame.player1StandButtonSplitH2:Disable()
playerFrame.player1StandButtonSplitH2:Hide()
-- Double (Split H2)
playerFrame.player1DoubleButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player1DoubleButtonSplitH2:SetPoint("BOTTOM", playerFrame, 419, 215)
playerFrame.player1DoubleButtonSplitH2:SetSize(65, 30)
playerFrame.player1DoubleButtonSplitH2:SetText("Double")
playerFrame.player1DoubleButtonSplitH2:Disable()
playerFrame.player1DoubleButtonSplitH2:Hide()
-- Main Bet Confirm
player1ConfirmMainBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player1ConfirmMainBetButton:SetPoint("BOTTOM", playerFrame, 485, 335)
player1ConfirmMainBetButton:SetSize(65, 30)
player1ConfirmMainBetButton:SetText("Bet")
player1ConfirmMainBetButton:Hide()
-- Perfect Pairs Confirm
player1ConfirmPPBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player1ConfirmPPBetButton:SetPoint("BOTTOM", playerFrame, 309, 335)
player1ConfirmPPBetButton:SetSize(43, 25)
player1ConfirmPPBetButton:SetText("Bet")
player1ConfirmPPBetButton:Hide()
-- 21+3 Confirm
player1Confirm213BetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player1Confirm213BetButton:SetPoint("BOTTOM", playerFrame, 385, 470)
player1Confirm213BetButton:SetSize(43, 25)
player1Confirm213BetButton:SetText("Bet")
player1Confirm213BetButton:Hide()

-- Wagers for Player 1
-- Main Bet
player1MainBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player1MainBetEditBox:SetSize(55, 30)
player1MainBetEditBox:SetPoint("BOTTOM", playerFrame, 422, 335)
player1MainBetEditBox:SetAutoFocus(false)
player1MainBetEditBox:SetNumeric(true)
player1MainBetEditBox:Hide()
-- Split Hand 1
player1SplitH1EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player1SplitH1EditBox:SetSize(55, 30)
player1SplitH1EditBox:SetPoint("BOTTOM", playerFrame, 487, 335)
player1SplitH1EditBox:SetAutoFocus(false)
player1SplitH1EditBox:SetNumeric(true)
player1SplitH1EditBox:ClearFocus()
player1SplitH1EditBox:Disable()
player1SplitH1EditBox:Hide()
-- Split Hand 2
player1SplitH2EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player1SplitH2EditBox:SetSize(55, 30)
player1SplitH2EditBox:SetPoint("BOTTOM", playerFrame, 422, 335)
player1SplitH2EditBox:SetAutoFocus(false)
player1SplitH2EditBox:SetNumeric(true)
player1SplitH2EditBox:ClearFocus()
player1SplitH2EditBox:Disable()
player1SplitH2EditBox:Hide()
-- Perfect Pairs
player1PPBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player1PPBetEditBox:SetSize(35, 30)
player1PPBetEditBox:SetPoint("BOTTOM", playerFrame, 312, 355)
player1PPBetEditBox:SetAutoFocus(false)
player1PPBetEditBox:SetNumeric(true)
player1PPBetEditBox:Hide()
-- 21+3
player1213BetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player1213BetEditBox:SetSize(35, 30)
player1213BetEditBox:SetPoint("BOTTOM", playerFrame, 388, 490)
player1213BetEditBox:SetAutoFocus(false)
player1213BetEditBox:SetNumeric(true)
player1213BetEditBox:Hide()

-- Labels for Player 1
-- Main Bet
playerFrame.player1MainBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1MainBetTitle:SetPoint("BOTTOM", playerFrame, 421, 362)
playerFrame.player1MainBetTitle:SetJustifyH("CENTER")
playerFrame.player1MainBetTitle:SetText("Main Bet")
playerFrame.player1MainBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player1MainBetTitle:Hide()
-- Split Hand 1
playerFrame.player1SplitH1Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1SplitH1Title:SetPoint("BOTTOM", playerFrame, 486, 362)
playerFrame.player1SplitH1Title:SetJustifyH("CENTER")
playerFrame.player1SplitH1Title:SetText("Hand 1")
playerFrame.player1SplitH1Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player1SplitH1Title:Hide()
-- Split Hand 2
playerFrame.player1SplitH2Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1SplitH2Title:SetPoint("BOTTOM", playerFrame, 421, 362)
playerFrame.player1SplitH2Title:SetJustifyH("CENTER")
playerFrame.player1SplitH2Title:SetText("Hand 2")
playerFrame.player1SplitH2Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player1SplitH2Title:Hide()
-- Main Bet Amount
player1MainBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1MainBetAmount:SetPoint("CENTER", playerFrame, 338, 100)
player1MainBetAmount:SetJustifyH("CENTER")
player1MainBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 1 Amount
player1SplitH1BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1SplitH1BetAmount:SetPoint("CENTER", playerFrame, 355, 115)
player1SplitH1BetAmount:SetJustifyH("CENTER")
player1SplitH1BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 2 Amount
player1SplitH2BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1SplitH2BetAmount:SetPoint("CENTER", playerFrame, 327, 91)
player1SplitH2BetAmount:SetJustifyH("CENTER")
player1SplitH2BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Perfect Pairs
playerFrame.player1PPBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1PPBetTitle:SetPoint("BOTTOM", playerFrame, 276, 353)
playerFrame.player1PPBetTitle:SetJustifyH("CENTER")
playerFrame.player1PPBetTitle:SetText("PP")
playerFrame.player1PPBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player1PPBetTitle:Hide()
-- Perfect Pairs Amount
player1PPBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1PPBetAmount:SetPoint("CENTER", playerFrame, 275, 60)
player1PPBetAmount:SetJustifyH("CENTER")
player1PPBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- 21+3
playerFrame.player1213BetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1213BetTitle:SetPoint("BOTTOM", playerFrame, 430, 488)
playerFrame.player1213BetTitle:SetJustifyH("CENTER")
playerFrame.player1213BetTitle:SetText("21+3")
playerFrame.player1213BetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player1213BetTitle:Hide()
-- 21+3 Amount
player1213BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player1213BetAmount:SetPoint("CENTER", playerFrame, 345, 156)
player1213BetAmount:SetJustifyH("CENTER")
player1213BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Insurance Amount
playerFrame.player1InsuranceBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1InsuranceBetAmount:SetPoint("CENTER", playerFrame, 559, -110)
playerFrame.player1InsuranceBetAmount:SetJustifyH("CENTER")
playerFrame.player1InsuranceBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE")
-- Player Name
playerFrame.player1Name = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1Name:SetPoint("BOTTOM", playerFrame, 452, 311)
playerFrame.player1Name:SetText("Seat Empty")
playerFrame.player1Name:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
-- Insurance
playerFrame.player1InsuranceTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1InsuranceTitle:SetPoint("BOTTOM", playerFrame, 452, 229) 
playerFrame.player1InsuranceTitle:SetText("Insurance")
playerFrame.player1InsuranceTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
playerFrame.player1InsuranceTitle:Hide()
-- Insurance (if available)
playerFrame.player1InsuranceSubtitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1InsuranceSubtitle:SetPoint("BOTTOM", playerFrame, 452, 219)
playerFrame.player1InsuranceSubtitle:SetText("(if available)")
playerFrame.player1InsuranceSubtitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player1InsuranceSubtitle:Hide()
-- Session Win Update
playerFrame.player1WinningsUpdate = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player1WinningsUpdate:SetPoint("BOTTOMLEFT", playerFrame, 270, 30) 
playerFrame.player1WinningsUpdate:SetText("")
playerFrame.player1WinningsUpdate:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
playerFrame.player1WinningsUpdate:SetTextColor(0.118, 0.839, 0.412)

-- Images for Player 1
-- Turn Arrow
playerFrame.player1TurnArrow = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1TurnArrow:SetSize(128, 128)
playerFrame.player1TurnArrow:SetPoint("CENTER", playerFrame, 560, -15)
playerFrame.player1TurnArrow:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\TurnArrow.tga")
playerFrame.player1TurnArrow:SetBlendMode("BLEND")
playerFrame.player1TurnArrow:SetDrawLayer("OVERLAY")
playerFrame.player1TurnArrow:Hide()
-- Main Bet
playerFrame.player1MainBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1MainBetCoins:SetSize(128, 128)
playerFrame.player1MainBetCoins:SetPoint("CENTER", playerFrame, 355, 70)
playerFrame.player1MainBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player1MainBetCoins:SetBlendMode("BLEND")
playerFrame.player1MainBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player1MainBetCoins:Hide()
-- Win
playerFrame.player1NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1NormalWinCoins:SetSize(128, 128)
playerFrame.player1NormalWinCoins:SetPoint("CENTER", playerFrame, 355, 70)
playerFrame.player1NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player1NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player1NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1NormalWinCoins:Hide()
-- Split Hand 2 Bet
playerFrame.player1SplitHand2Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand2Coins:SetSize(128, 128)
playerFrame.player1SplitHand2Coins:SetPoint("CENTER", playerFrame, 345, 58)
playerFrame.player1SplitHand2Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player1SplitHand2Coins:SetBlendMode("BLEND")
playerFrame.player1SplitHand2Coins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand2Coins:Hide()
-- Split Double Hand 2 Bet
playerFrame.player1SplitHand2DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand2DoubleCoins:SetSize(128, 128)
playerFrame.player1SplitHand2DoubleCoins:SetPoint("CENTER", playerFrame, 345, 58)
playerFrame.player1SplitHand2DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player1SplitHand2DoubleCoins:SetBlendMode("BLEND")
playerFrame.player1SplitHand2DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand2DoubleCoins:Hide()
-- Split Win Hand 2
playerFrame.player1SplitHand2NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand2NormalWinCoins:SetSize(128, 128)
playerFrame.player1SplitHand2NormalWinCoins:SetPoint("CENTER", playerFrame, 345, 58)
playerFrame.player1SplitHand2NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player1SplitHand2NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player1SplitHand2NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand2NormalWinCoins:Hide()
-- Split Hand 1 Bet
playerFrame.player1SplitHand1Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand1Coins:SetSize(128, 128)
playerFrame.player1SplitHand1Coins:SetPoint("CENTER", playerFrame, 372, 83)
playerFrame.player1SplitHand1Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player1SplitHand1Coins:SetBlendMode("BLEND")
playerFrame.player1SplitHand1Coins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand1Coins:Hide()
-- Split Double Hand 1 Bet
playerFrame.player1SplitHand1DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand1DoubleCoins:SetSize(128, 128)
playerFrame.player1SplitHand1DoubleCoins:SetPoint("CENTER", playerFrame, 372, 83)
playerFrame.player1SplitHand1DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player1SplitHand1DoubleCoins:SetBlendMode("BLEND")
playerFrame.player1SplitHand1DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand1DoubleCoins:Hide()
-- Split Win Hand 1
playerFrame.player1SplitHand1NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand1NormalWinCoins:SetSize(128, 128)
playerFrame.player1SplitHand1NormalWinCoins:SetPoint("CENTER", playerFrame, 372, 83)
playerFrame.player1SplitHand1NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player1SplitHand1NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player1SplitHand1NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand1NormalWinCoins:Hide()
-- Blackjack Win
playerFrame.player1BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1BJWinCoins:SetSize(128, 128)
playerFrame.player1BJWinCoins:SetPoint("CENTER", playerFrame, 355, 70)
playerFrame.player1BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player1BJWinCoins:SetBlendMode("BLEND")
playerFrame.player1BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1BJWinCoins:Hide()
-- Split BJ Win Hand 2
playerFrame.player1SplitHand2BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand2BJWinCoins:SetSize(128, 128)
playerFrame.player1SplitHand2BJWinCoins:SetPoint("CENTER", playerFrame, 345, 58)
playerFrame.player1SplitHand2BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player1SplitHand2BJWinCoins:SetBlendMode("BLEND")
playerFrame.player1SplitHand2BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand2BJWinCoins:Hide()
-- Split BJ Win Hand 1
playerFrame.player1SplitHand1BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1SplitHand1BJWinCoins:SetSize(128, 128)
playerFrame.player1SplitHand1BJWinCoins:SetPoint("CENTER", playerFrame, 372, 83)
playerFrame.player1SplitHand1BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player1SplitHand1BJWinCoins:SetBlendMode("BLEND")
playerFrame.player1SplitHand1BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1SplitHand1BJWinCoins:Hide()
-- Double Bet
playerFrame.player1DoubleBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1DoubleBetCoins:SetSize(128, 128)
playerFrame.player1DoubleBetCoins:SetPoint("CENTER", playerFrame, 355, 70)
playerFrame.player1DoubleBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player1DoubleBetCoins:SetBlendMode("BLEND")
playerFrame.player1DoubleBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player1DoubleBetCoins:Hide()
-- PP Bet
playerFrame.player1PPBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1PPBetCoins:SetSize(128, 128)
playerFrame.player1PPBetCoins:SetPoint("CENTER", playerFrame, 280, 40)
playerFrame.player1PPBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player1PPBetCoins:SetBlendMode("BLEND")
playerFrame.player1PPBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player1PPBetCoins:Hide()
-- 21+3 Bet
playerFrame.player1213BetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1213BetCoins:SetSize(128, 128)
playerFrame.player1213BetCoins:SetPoint("CENTER", playerFrame, 350, 136)
playerFrame.player1213BetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player1213BetCoins:SetBlendMode("BLEND")
playerFrame.player1213BetCoins:SetDrawLayer("OVERLAY")
playerFrame.player1213BetCoins:Hide()
-- PP Win
playerFrame.player1PPWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1PPWinCoins:SetSize(128, 128)
playerFrame.player1PPWinCoins:SetPoint("CENTER", playerFrame, 292, 44)
playerFrame.player1PPWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player1PPWinCoins:SetBlendMode("BLEND")
playerFrame.player1PPWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1PPWinCoins:Hide()
-- 21+3 Win
playerFrame.player1213WinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player1213WinCoins:SetSize(128, 128)
playerFrame.player1213WinCoins:SetPoint("CENTER", playerFrame, 361, 141)
playerFrame.player1213WinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player1213WinCoins:SetBlendMode("BLEND")
playerFrame.player1213WinCoins:SetDrawLayer("OVERLAY")
playerFrame.player1213WinCoins:Hide()
-- Insurance YES for Player 1
player1InsuranceYesIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player1InsuranceYesIcon:SetSize(24, 24)
player1InsuranceYesIcon:SetPoint("CENTER", playerFrame, 556, -129)
player1InsuranceYesIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceYes.tga")
player1InsuranceYesIcon:SetDrawLayer("ARTWORK")
player1InsuranceYesIcon:Hide()
-- Insurance NO for Player 1
player1InsuranceNoIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player1InsuranceNoIcon:SetSize(24, 24)
player1InsuranceNoIcon:SetPoint("CENTER", playerFrame, 556, -129)
player1InsuranceNoIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceNo.tga")
player1InsuranceNoIcon:SetDrawLayer("ARTWORK")
player1InsuranceNoIcon:Hide()

-- BJ Win Coins
function player1PlaceCoinsBJWin(message)
    playerFrame.player1MainBetCoins:Hide()
    playerFrame.player1BJWinCoins:Show()
end

-- Regular Win Coins
function player1PlaceCoinsRegularWin(message)
    playerFrame.player1MainBetCoins:Hide()
    playerFrame.player1DoubleBetCoins:Show()
end

-- Main Bet Coins
function player1PlaceCoinsMainBet(message)
    playerFrame.player1MainBetCoins:Show()
end

-- Double Bet Coins
function player1PlaceCoinsDoubleBet(message)
    playerFrame.player1MainBetCoins:Hide()
    playerFrame.player1DoubleBetCoins:Show()
end

-- Function to handle Player 1 Main Bet Text
function player1PlaceTextMainBet(message)
    local player1HistoryMainBet = string.match(message, "(%d+)G")

        if player1HistoryMainBet then
            player1MainBetAmount:SetText(player1HistoryMainBet .. " G")
            player1MainBetAmount:Show()

            if playerName == unitName1 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName1]
                    player1totalBetAmount = player1totalBetAmount + tonumber(player1HistoryMainBet)
                    bankingInfo.totalWagered = player1totalBetAmount
                end
            end

            historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")

        else
    end
end

-- Player 1 Split Hand Bet Text
function player1SplitHand1BetText(Amount)
    player1MainBetAmount:Hide()
    player1MainBetAmount:SetText("")
    player1SplitH1BetAmount:SetText(Amount .. " G")
    player1SplitH1BetAmount:Show()
    player1SplitH2BetAmount:SetText(Amount .. " G")
    player1SplitH2BetAmount:Show()
end

-- Player 1 Split Bet Image
function player1PlaceSplitBet(message)
    playerFrame.player1MainBetCoins:Hide()
    playerFrame.player1SplitHand1Coins:Show()
    playerFrame.player1SplitHand2Coins:Show()
end

-- Player 1 Place Initial Card Images
function player1PlaceSplitCards(message)

    -- Players: 1
    if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[3]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[3]
        turn = 8 -- Player 1: 2nd Card (Split H1)

    -- Players: 1, 2
    elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[4]
        turn = 10 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 3
    elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[4]
        turn = 10 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 4
    elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[4]
        turn = 10 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 5
    elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[4]
        turn = 10 -- Player 1: 2nd Card (Split H1)

    -- Players: 1, 2, 3
    elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[5]
        turn = 12 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 2, 4
    elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[5]
        turn = 12 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 2, 5
    elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[5]
        turn = 12 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 3, 4
    elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[5]
        turn = 12 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 3, 5
    elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[5]
        turn = 12 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 4, 5
    elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[5]
        turn = 12 -- Player 1: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4
    elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[1]:Hide()
        drawnCards[6]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[6]
        turn = 14 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 2, 3, 5
    elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[6]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[6]
        turn = 14 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 2, 4, 5
    elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[6]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[6]
        turn = 14 -- Player 1: 2nd Card (Split H1)
    -- Players: 1, 3, 4, 5
    elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[6]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[6]
        turn = 14 -- Player 1: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4, 5
    elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[7]:Hide()
        player1cardName1 = dealtCards[1]
        player1cardName2 = dealtCards[6]
        turn = 16 -- Player 1: 2nd Card (Split H1)
    end

    player1cardImageFile1 = nil
    player1cardImageFile2 = nil

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player1cardName1 then
            player1cardImageFile1 = filename
            break
        end
    end

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player1cardName2 then
            player1cardImageFile2 = filename
            break
        end
    end

    player1NewCardImage1 = CreateFrame("Frame", nil, playerFrame)
    player1NewCardImage1:SetSize(32, 64)
    player1NewCardImage1:SetPoint("BOTTOM", playerFrame, 302, 454)
    player1NewCardImage1.texture = player1NewCardImage1:CreateTexture()
    player1NewCardImage1.texture:SetAllPoints()
    player1NewCardImage1.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1cardImageFile1)
    player1NewCardImage1:Show()

    player1NewCardImage2 = CreateFrame("Frame", nil, playerFrame)
    player1NewCardImage2:SetSize(32, 64)
    player1NewCardImage2:SetPoint("BOTTOM", playerFrame, 265, 435)
    player1NewCardImage2.texture = player1NewCardImage2:CreateTexture()
    player1NewCardImage2.texture:SetAllPoints()
    player1NewCardImage2.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1cardImageFile2)
    player1NewCardImage2:Show()

end

-- Player 1 Split Function
function player1HandleSplit(message)
    player1PlaceSplitBet()
    local player1MainBetAmountValue = tonumber(string.match(player1MainBetAmount:GetText(), "%d+"))
    if player1MainBetAmountValue then
        player1SplitHand1BetText(player1MainBetAmountValue)
    end 

    player1PlaceSplitCards()

    -- A,A
    if playerFrame.player1CardTotalText:GetText() == "2 or 12" then
        playerFrame.player1SplitHand1CardTotalText:SetText("1 or 11")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("1 or 11")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 2,2
    elseif playerFrame.player1CardTotalText:GetText() == "4" then
        playerFrame.player1SplitHand1CardTotalText:SetText("2")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("2")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 3,3
    elseif playerFrame.player1CardTotalText:GetText() == "6" then
        playerFrame.player1SplitHand1CardTotalText:SetText("3")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("3")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 4,4
    elseif playerFrame.player1CardTotalText:GetText() == "8" then
        playerFrame.player1SplitHand1CardTotalText:SetText("4")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("4")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 5,5
    elseif playerFrame.player1CardTotalText:GetText() == "10" then
        playerFrame.player1SplitHand1CardTotalText:SetText("5")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("5")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 6,6
    elseif playerFrame.player1CardTotalText:GetText() == "12" then
        playerFrame.player1SplitHand1CardTotalText:SetText("6")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("6")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 7,7
    elseif playerFrame.player1CardTotalText:GetText() == "14" then
        playerFrame.player1SplitHand1CardTotalText:SetText("7")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("7")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 8,8
    elseif playerFrame.player1CardTotalText:GetText() == "16" then
        playerFrame.player1SplitHand1CardTotalText:SetText("8")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("8")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 9,9
    elseif playerFrame.player1CardTotalText:GetText() == "18" then
        playerFrame.player1SplitHand1CardTotalText:SetText("9")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("9")
        playerFrame.player1SplitHand2CardTotalText:Show()
    -- 10,10
    elseif playerFrame.player1CardTotalText:GetText() == "20" then
        playerFrame.player1SplitHand1CardTotalText:SetText("10")
        playerFrame.player1SplitHand1CardTotalText:Show()
        playerFrame.player1SplitHand2CardTotalText:SetText("10")
        playerFrame.player1SplitHand2CardTotalText:Show()
    end

    playerFrame.player1CardTotalText:SetText("")
    playerFrame.player1CardTotalText:Hide()
    
    if playerName == unitName1 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player1totalBetAmount = player1totalBetAmount + tonumber(player1MainBetAmountValue)
            bankingInfo.totalWagered = player1totalBetAmount
            player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1MainBetAmountValue)
            bankingInfo.bankrollTable = player1TotalBankrollAmount
        end
    end

    historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")
    bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

    player1SplitToggle = true

    if player1dealtCardsFrame:IsShown() then
        player1dealtCardsFrame:Hide()
        player1dealtCardsFrame.playerCardsButton:Hide()
        player1dealtCardsFrameSplitH1:Show()
        player1dealtCardsFrameSplitH1.playerH1CardsButton:Show()
    end

end

-- Function to handle Player 1 PP Bet Image
function player1PlaceCoinsPPBet(message)
    playerFrame.player1PPBetCoins:Show()
end

-- Function to handle Player 1 PP Bet Text
function player1PlaceTextPPBet(message)
    local player1HistoryPPBet = string.match(message, "(%d+)G")

        if player1HistoryPPBet then
            player1PPBetAmount:SetText(player1HistoryPPBet .. " G")
            player1PPBetAmount:Show()

            if playerName == unitName1 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName1]
                    player1totalBetAmount = player1totalBetAmount + tonumber(player1HistoryPPBet)
                    bankingInfo.totalWagered = player1totalBetAmount
                end
            end

            historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")

        else
    end
end

-- Function to handle Player 1 21+3 Bet Image
function player1PlaceCoins213Bet(message)
    playerFrame.player1213BetCoins:Show()
end

-- Function to handle Player 1 21+3 Bet Text
function player1PlaceText213Bet(message)
    local player1History213Bet = string.match(message, "(%d+)G")

        if player1History213Bet then
            player1213BetAmount:SetText(player1History213Bet .. " G")
            player1213BetAmount:Show()

            if playerName == unitName1 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName1]
                    player1totalBetAmount = player1totalBetAmount + tonumber(player1History213Bet)
                    bankingInfo.totalWagered = player1totalBetAmount
                end
            end

            historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")

        else
    end
end

function player1PreloadBet()
    
    player1MainBet = tonumber(player1PreloadEditBoxMainBet:GetText()) or 0
    player1PPBet = tonumber(player1PreloadEditBoxPPBet:GetText()) or 0
    player1213Bet = tonumber(player1PreloadEditBox213Bet:GetText()) or 0

    player1TotalRebetAmount = player1MainBet + player1PPBet + player1213Bet

    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1currentBankroll - player1TotalRebetAmount < 0 then
        print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
    else
        local player1Threshold = minBetMain - 1
        if player1MainBet <= player1Threshold then
            print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
        else
            if player1MainBet and player1MainBet >= minBetMain and player1MainBet <= maxBetMain then
                PlaySoundFile(soundFilePaths[33])
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P1] Placing a " ..player1MainBet.. "G main bet.", "RAID")
                -- Disable the edit box and button
                player1PreloadEditBoxMainBet:SetFocus(false)
                player1PreloadEditBoxMainBet:ClearFocus()
                player1MainBetEditBox:SetText("")
                player1MainBetEditBox:SetText(player1MainBet)
                player1MainBetEditBox:SetFocus(false)
                player1MainBetEditBox:ClearFocus()
                player1MainBetEditBox:Disable()
                player1ConfirmMainBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1MainBet)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end
            end

            if player1PPBet and player1PPBet >= minBetPP and player1PPBet <= maxBetPP then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P1] Placing a " ..player1PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player1PreloadEditBoxPPBet:SetFocus(false)
                player1PreloadEditBoxPPBet:ClearFocus()
                player1PPBetEditBox:SetText("")
                player1PPBetEditBox:SetText(player1PPBet)
                player1PPBetEditBox:SetFocus(false)
                player1PPBetEditBox:ClearFocus()
                player1PPBetEditBox:Disable()
                player1ConfirmPPBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1PPBet)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end
            end

            if player1213Bet and player1213Bet >= minBet213 and player1213Bet <= maxBet213 then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P1] Placing a " ..player1213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player1PreloadEditBox213Bet:SetFocus(false)
                player1PreloadEditBox213Bet:ClearFocus()
                player1213BetEditBox:SetText("")
                player1213BetEditBox:SetText(player1213Bet)
                player1213BetEditBox:SetFocus(false)
                player1213BetEditBox:ClearFocus()
                player1213BetEditBox:Disable()
                player1Confirm213BetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1213Bet)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end
            end

            player1PreloadBetButton:Disable()

        end

        bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

    end

end

-- Function to handle the Player 1 Main "Bet" button click
function player1ConfirmMainBetClick()
    player1MainBet = tonumber(player1MainBetEditBox:GetText())
    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1MainBet and player1MainBet >= minBetMain and player1MainBet <= maxBetMain then
        if player1currentBankroll - player1MainBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            -- Valid bet amount, send the message with the bet
            SendChatMessage("[P1] Placing a " ..player1MainBet.. "G main bet.", "RAID")
            -- Disable the edit box and button
            player1MainBetEditBox:SetFocus(false)
            player1MainBetEditBox:ClearFocus()
            player1MainBetEditBox:Disable()
            player1ConfirmMainBetButton:Disable()

            player1PreloadBetButton:Disable()

            PlaySoundFile(soundFilePaths[33]) 

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1MainBet)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetMain .. "G and " .. maxBetMain .. "G.")
    end

end

-- Function to handle the Player 1 PP "Bet" button click
function player1ConfirmPPBetClick()
    player1PPBet = tonumber(player1PPBetEditBox:GetText()) -- Get the entered bet amount
    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1PPBet and player1PPBet >= minBetPP and player1PPBet <= maxBetPP then
        if player1currentBankroll - player1PPBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player1Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P1] Placing a " ..player1PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player1PPBetEditBox:SetFocus(false)
                player1PPBetEditBox:ClearFocus()
                player1PPBetEditBox:Disable()
                player1ConfirmPPBetButton:Disable()

                player1PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1PPBet)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end

                bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
                cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetPP .. "G and " .. maxBetPP .. "G.")
    end

end

-- Function to handle the Player 1 21+3 "Bet" button click
function player1Confirm213BetClick()
    player1213Bet = tonumber(player1213BetEditBox:GetText()) -- Get the entered bet amount
    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1213Bet and player1213Bet >= minBet213 and player1213Bet <= maxBet213 then
        if player1currentBankroll - player1213Bet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player1Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P1] Placing a " ..player1213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player1213BetEditBox:SetFocus(false)
                player1213BetEditBox:ClearFocus()
                player1213BetEditBox:Disable()
                player1Confirm213BetButton:Disable()

                player1PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1213Bet)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end

                bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
                cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBet213 .. "G and " .. maxBet213 .. "G.")
    end
 
end

-- Player 1 Main "Bet" button
player1ConfirmMainBetButton:SetScript("OnClick", player1ConfirmMainBetClick)

-- Player 1 PP "Bet" button
player1ConfirmPPBetButton:SetScript("OnClick", player1ConfirmPPBetClick)

-- Player 1 21+3 "Bet" button
player1Confirm213BetButton:SetScript("OnClick", player1Confirm213BetClick)

-- Player 1 "Bet All" Preload button
player1PreloadBetButton:SetScript("OnClick", player1PreloadBet)

function player1resetRaidChannel()
    if playerName == unitName1 then
        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/raid", chatFrame)
        
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:SetText("")
        editBox:Insert("/raid")
        
        ChatEdit_SendText(editBox)
        ChatEdit_DeactivateChat(editBox)
    else
        print("")
    end
end

player1HotstreakImage1 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage1:SetSize(36, 36)
player1HotstreakImage1:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak1.tga")
player1HotstreakImage1:SetDrawLayer("OVERLAY")
player1HotstreakImage1:Hide()

player1HotstreakImage2 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage2:SetSize(36, 36)
player1HotstreakImage2:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak2.tga")
player1HotstreakImage2:SetDrawLayer("OVERLAY")
player1HotstreakImage2:Hide()

player1HotstreakImage3 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage3:SetSize(36, 36)
player1HotstreakImage3:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak3.tga")
player1HotstreakImage3:SetDrawLayer("OVERLAY")
player1HotstreakImage3:Hide()

player1HotstreakImage4 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage4:SetSize(36, 36)
player1HotstreakImage4:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak4.tga")
player1HotstreakImage4:SetDrawLayer("OVERLAY")
player1HotstreakImage4:Hide()

player1HotstreakImage5 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage5:SetSize(36, 36)
player1HotstreakImage5:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak5.tga")
player1HotstreakImage5:SetDrawLayer("OVERLAY")
player1HotstreakImage5:Hide()

player1HotstreakImage6 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage6:SetSize(36, 36)
player1HotstreakImage6:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak6.tga")
player1HotstreakImage6:SetDrawLayer("OVERLAY")
player1HotstreakImage6:Hide()

player1HotstreakImage7 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage7:SetSize(36, 36)
player1HotstreakImage7:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak7.tga")
player1HotstreakImage7:SetDrawLayer("OVERLAY")
player1HotstreakImage7:Hide()

player1HotstreakImage8 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage8:SetSize(36, 36)
player1HotstreakImage8:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage8:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak8.tga")
player1HotstreakImage8:SetDrawLayer("OVERLAY")
player1HotstreakImage8:Hide()

player1HotstreakImage9 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage9:SetSize(36, 36)
player1HotstreakImage9:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage9:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak9.tga")
player1HotstreakImage9:SetDrawLayer("OVERLAY")
player1HotstreakImage9:Hide()

player1HotstreakImage10 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage10:SetSize(36, 36)
player1HotstreakImage10:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage10:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak10.tga")
player1HotstreakImage10:SetDrawLayer("OVERLAY")
player1HotstreakImage10:Hide()

player1HotstreakImage11 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage11:SetSize(36, 36)
player1HotstreakImage11:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage11:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak11.tga")
player1HotstreakImage11:SetDrawLayer("OVERLAY")
player1HotstreakImage11:Hide()

player1HotstreakImage12 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage12:SetSize(36, 36)
player1HotstreakImage12:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage12:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak12.tga")
player1HotstreakImage12:SetDrawLayer("OVERLAY")
player1HotstreakImage12:Hide()

player1HotstreakImage13 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage13:SetSize(36, 36)
player1HotstreakImage13:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage13:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak13.tga")
player1HotstreakImage13:SetDrawLayer("OVERLAY")
player1HotstreakImage13:Hide()

player1HotstreakImage14 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage14:SetSize(36, 36)
player1HotstreakImage14:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage14:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak14.tga")
player1HotstreakImage14:SetDrawLayer("OVERLAY")
player1HotstreakImage14:Hide()

player1HotstreakImage15 = playerFrame:CreateTexture(nil, "OVERLAY")
player1HotstreakImage15:SetSize(36, 36)
player1HotstreakImage15:SetPoint("CENTER", playerFrame, 367, -79)
player1HotstreakImage15:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak15.tga")
player1HotstreakImage15:SetDrawLayer("OVERLAY")
player1HotstreakImage15:Hide()

local function player1HotStreakCheck()
    if player1Hotstreak == 0 then
        player1HotstreakImage1:Hide()
        player1HotstreakImage2:Hide()
        player1HotstreakImage3:Hide()
        player1HotstreakImage4:Hide()
        player1HotstreakImage5:Hide()
        player1HotstreakImage6:Hide()
        player1HotstreakImage7:Hide()
        player1HotstreakImage8:Hide()
        player1HotstreakImage9:Hide()
        player1HotstreakImage10:Hide()
        player1HotstreakImage11:Hide()
        player1HotstreakImage12:Hide()
        player1HotstreakImage13:Hide()
        player1HotstreakImage14:Hide()
        player1HotstreakImage15:Hide()
    elseif player1Hotstreak == 1 then
        player1HotstreakImage1:Show()
    elseif player1Hotstreak == 2 then
        player1HotstreakImage1:Hide()
        player1HotstreakImage2:Show()
    elseif player1Hotstreak == 3 then
        player1HotstreakImage1:Hide()
        player1HotstreakImage2:Hide()
        player1HotstreakImage3:Show()
    elseif player1Hotstreak == 4 then
        player1HotstreakImage2:Hide()
        player1HotstreakImage3:Hide()
        player1HotstreakImage4:Show()
    elseif player1Hotstreak == 5 then
        player1HotstreakImage3:Hide()
        player1HotstreakImage4:Hide()
        player1HotstreakImage5:Show()
    elseif player1Hotstreak == 6 then
        player1HotstreakImage4:Hide()
        player1HotstreakImage5:Hide()
        player1HotstreakImage6:Show()
    elseif player1Hotstreak == 7 then
        player1HotstreakImage5:Hide()
        player1HotstreakImage6:Hide()
        player1HotstreakImage7:Show()
    elseif player1Hotstreak == 8 then
        player1HotstreakImage6:Hide()
        player1HotstreakImage7:Hide()
        player1HotstreakImage8:Show()
    elseif player1Hotstreak == 9 then
        player1HotstreakImage7:Hide()
        player1HotstreakImage8:Hide()
        player1HotstreakImage9:Show()
    elseif player1Hotstreak == 10 then
        player1HotstreakImage8:Hide()
        player1HotstreakImage9:Hide()
        player1HotstreakImage10:Show()
    elseif player1Hotstreak == 11 then
        player1HotstreakImage9:Hide()
        player1HotstreakImage10:Hide()
        player1HotstreakImage11:Show()
    elseif player1Hotstreak == 12 then
        player1HotstreakImage10:Hide()
        player1HotstreakImage11:Hide()
        player1HotstreakImage12:Show()
    elseif player1Hotstreak == 13 then
        player1HotstreakImage11:Hide()
        player1HotstreakImage12:Hide()
        player1HotstreakImage13:Show()
    elseif player1Hotstreak == 14 then
        player1HotstreakImage12:Hide()
        player1HotstreakImage13:Hide()
        player1HotstreakImage14:Show()
    elseif player1Hotstreak == 15 then
        player1HotstreakImage13:Hide()
        player1HotstreakImage14:Hide()
        player1HotstreakImage15:Show()
    end
end

-- Function to handle Player 1 PP Win Image
function player1PlaceBetsPPWin(message)
    playerFrame.player1PPBetCoins:Hide()
    playerFrame.player1PPWinCoins:Show()
    player1PPBetAmount:SetPoint("CENTER", playerFrame, 274, 77)
end

-- Function to handle Player 1 21+3 Win Image
function player1PlaceBets213Win(message)
    playerFrame.player1213BetCoins:Hide()
    playerFrame.player1213WinCoins:Show()
    player1213BetAmount:SetPoint("CENTER", playerFrame, 345, 174)
end

function player1MixedPairWin(message)

    if playerName == unitName1 then
        player1PPBetAmountValue = tonumber(string.match(player1PPBetEditBox:GetText(), "%d+"))
        if player1PPBetAmountValue then
            player1NewPPAmount = player1PPBetAmountValue * mixedPairPayoutReturn
            player1PPBetAmount:SetText(player1NewPPAmount .. " G")
            player1PPBetAmount:SetTextColor(0, 1, 0)

            player1PPProfitvalue = player1NewPPAmount - player1PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1totalWin = player1totalWin + tonumber(player1PPProfitvalue)
                    bankingInfo.totalWon = player1totalWin
                    player1totalProfit = player1totalProfit + tonumber(player1PPProfitvalue)
                    bankingInfo.totalProfit = player1totalProfit
                    player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1NewPPAmount)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end

            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1PPBetAmountValue = tonumber(string.match(player1PPBetAmount:GetText(), "%d+"))
        if player1PPBetAmountValue then
            player1NewPPAmount = player1PPBetAmountValue * mixedPairPayoutReturn
            player1PPBetAmount:SetText(player1NewPPAmount .. " G")
            player1PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBetsPPWin()
    player1PPSideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1NewPPAmount)

end

function player1ColouredPairWin(message)

    if playerName == unitName1 then
        player1PPBetAmountValue = tonumber(string.match(player1PPBetEditBox:GetText(), "%d+"))
        if player1PPBetAmountValue then
            player1NewPPAmount = player1PPBetAmountValue * colouredPairPayoutReturn
            player1PPBetAmount:SetText(player1NewPPAmount .. " G")
            player1PPBetAmount:SetTextColor(0, 1, 0)

            player1PPProfitvalue = player1NewPPAmount - player1PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1totalWin = player1totalWin + tonumber(player1PPProfitvalue)
                    bankingInfo.totalWon = player1totalWin
                    player1totalProfit = player1totalProfit + tonumber(player1PPProfitvalue)
                    bankingInfo.totalProfit = player1totalProfit
                    player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1NewPPAmount)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end

            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1PPBetAmountValue = tonumber(string.match(player1PPBetAmount:GetText(), "%d+"))
        if player1PPBetAmountValue then
            player1NewPPAmount = player1PPBetAmountValue * colouredPairPayoutReturn
            player1PPBetAmount:SetText(player1NewPPAmount .. " G")
            player1PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBetsPPWin()
    player1PPSideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1NewPPAmount)

end

function player1PerfectPairWin(message)

    if playerName == unitName1 then
        player1PPBetAmountValue = tonumber(string.match(player1PPBetEditBox:GetText(), "%d+"))
        if player1PPBetAmountValue then
            player1NewPPAmount = player1PPBetAmountValue * perfectPairPayoutReturn
            player1PPBetAmount:SetText(player1NewPPAmount .. " G")
            player1PPBetAmount:SetTextColor(0, 1, 0)

            player1PPProfitvalue = player1NewPPAmount - player1PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1totalWin = player1totalWin + tonumber(player1PPProfitvalue)
                    bankingInfo.totalWon = player1totalWin
                    player1totalProfit = player1totalProfit + tonumber(player1PPProfitvalue)
                    bankingInfo.totalProfit = player1totalProfit
                    player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1NewPPAmount)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end

            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1PPBetAmountValue = tonumber(string.match(player1PPBetAmount:GetText(), "%d+"))
        if player1PPBetAmountValue then
            player1NewPPAmount = player1PPBetAmountValue * perfectPairPayoutReturn
            player1PPBetAmount:SetText(player1NewPPAmount .. " G")
            player1PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBetsPPWin()
    player1PPSideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1NewPPAmount)

end

function player1SuitedThreeOfAKindWin(message)

    if playerName == unitName1 then
        player1213BetAmountValue = tonumber(string.match(player1213BetEditBox:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)

            player1213Profitvalue = player1New213Amount - player1213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalWin = player1totalWin + tonumber(player1213Profitvalue)
                bankingInfo.totalWon = player1totalWin
                player1totalProfit = player1totalProfit + tonumber(player1213Profitvalue)
                bankingInfo.totalProfit = player1totalProfit
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1New213Amount)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end

            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1213BetAmountValue = tonumber(string.match(player1213BetAmount:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBets213Win()
    player1213SideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1New213Amount)

end

function player1StraightFlushWin(message)

    if playerName == unitName1 then
        player1213BetAmountValue = tonumber(string.match(player1213BetEditBox:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * straightFlushPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)

            player1213Profitvalue = player1New213Amount - player1213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalWin = player1totalWin + tonumber(player1213Profitvalue)
                bankingInfo.totalWon = player1totalWin
                player1totalProfit = player1totalProfit + tonumber(player1213Profitvalue)
                bankingInfo.totalProfit = player1totalProfit
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1New213Amount)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end

            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1213BetAmountValue = tonumber(string.match(player1213BetAmount:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * straightFlushPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBets213Win()
    player1213SideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1New213Amount)

end

function player1ThreeOfAKindWin(message)

    if playerName == unitName1 then
        player1213BetAmountValue = tonumber(string.match(player1213BetEditBox:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * threeOfAKindPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)

            player1213Profitvalue = player1New213Amount - player1213BetAmountValue


            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalWin = player1totalWin + tonumber(player1213Profitvalue)
                bankingInfo.totalWon = player1totalWin
                player1totalProfit = player1totalProfit + tonumber(player1213Profitvalue)
                bankingInfo.totalProfit = player1totalProfit
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1New213Amount)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end


            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1213BetAmountValue = tonumber(string.match(player1213BetAmount:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * threeOfAKindPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBets213Win()
    player1213SideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1New213Amount)

end

function player1StraightWin(message)

    if playerName == unitName1 then
        player1213BetAmountValue = tonumber(string.match(player1213BetEditBox:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * straightPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)

            player1213Profitvalue = player1New213Amount - player1213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalWin = player1totalWin + tonumber(player1213Profitvalue)
                bankingInfo.totalWon = player1totalWin
                player1totalProfit = player1totalProfit + tonumber(player1213Profitvalue)
                bankingInfo.totalProfit = player1totalProfit
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1New213Amount)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end

            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1213BetAmountValue = tonumber(string.match(player1213BetAmount:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * straightPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBets213Win()
    player1213SideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1New213Amount)

end

function player1FlushWin(message)

    if playerName == unitName1 then
        player1213BetAmountValue = tonumber(string.match(player1213BetEditBox:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * flushPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)

            player1213Profitvalue = player1New213Amount - player1213BetAmountValue
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1totalWin = player1totalWin + tonumber(player1213Profitvalue)
                    bankingInfo.totalWon = player1totalWin
                    player1totalProfit = player1totalProfit + tonumber(player1213Profitvalue)
                    bankingInfo.totalProfit = player1totalProfit
                    player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1New213Amount)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end

            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        end
    else
        player1213BetAmountValue = tonumber(string.match(player1213BetAmount:GetText(), "%d+"))
        if player1213BetAmountValue then
            player1New213Amount = player1213BetAmountValue * flushPayoutReturn
            player1213BetAmount:SetText(player1New213Amount .. " G")
            player1213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player1PlaceBets213Win()
    player1213SideBetWin = true

    player1SessionWin = player1SessionWin + tonumber(player1New213Amount)

end

function player1Loss()
    player1MainBetValue = tonumber(string.match(player1MainBetAmount:GetText(), "%d+"))
    if player1MainBetValue then
        
        if playerName == unitName1 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalLoss = player1totalLoss + tonumber(player1MainBetValue)
                bankingInfo.totalLost = player1totalLoss
                player1totalProfit = player1totalProfit - tonumber(player1MainBetValue)
                bankingInfo.totalProfit = player1totalProfit
            end
        end

        if player1totalProfit >= 0 then
            historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
        historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")

        local player1PPBetText = player1PPBetAmount:GetText()

        if player1PPBetText and player1PPBetText ~= "" then
            player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
            
            if player1PPBetAmountValue then
                if player1PPSideBetWin == false then

                    player1PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")

                end
            end
        end

        local player1213BetText = player1213BetAmount:GetText()

        if player1213BetText and player1213BetText ~= "" then
            player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

            if player1213BetAmountValue then
                if player1213SideBetWin == false then

                    player1213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")

                end
            end
        end
    end
end

function player1SplitH1Loss()
    player1SplitHand1BetAmountValue = tonumber(string.match(player1SplitH1BetAmount:GetText(), "%d+"))
    if player1SplitHand1BetAmountValue then

        if playerName == unitName1 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalLoss = player1totalLoss + tonumber(player1SplitHand1BetAmountValue)
                bankingInfo.totalLost = player1totalLoss
                player1totalProfit = player1totalProfit - tonumber(player1SplitHand1BetAmountValue)
                bankingInfo.totalProfit = player1totalProfit
            end
        end

        historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
        historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")

        if player1totalProfit >= 0 then
            historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

    end
end

function player1SplitH2Loss()
    player1SplitHand2BetAmountValue = tonumber(string.match(player1SplitH2BetAmount:GetText(), "%d+"))
    if player1SplitHand2BetAmountValue then

        if playerName == unitName1 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalLoss = player1totalLoss + tonumber(player1SplitHand2BetAmountValue)
                bankingInfo.totalLost = player1totalLoss
                player1totalProfit = player1totalProfit - tonumber(player1SplitHand2BetAmountValue)
                bankingInfo.totalProfit = player1totalProfit
            end
        end

        historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
        historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")

        if player1totalProfit >= 0 then
            historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        local player1PPBetText = player1PPBetAmount:GetText()

        if player1PPBetText and player1PPBetText ~= "" then
            player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
            
            if player1PPBetAmountValue then
                if player1PPSideBetWin == false then

                    player1PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player1213BetText = player1213BetAmount:GetText()

        if player1213BetText and player1213BetText ~= "" then
            player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

            if player1213BetAmountValue then
                if player1213SideBetWin == false then

                    player1213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end
end

function player1Push()
    player1MainBetValue = tonumber(string.match(player1MainBetAmount:GetText(), "%d+"))
    if player1MainBetValue then


        if playerName == unitName1 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1MainBetValue)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end
        end

        bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

        local player1PPBetText = player1PPBetAmount:GetText()

        if player1PPBetText and player1PPBetText ~= "" then
            player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
            
            if player1PPBetAmountValue then
                if player1PPSideBetWin == false then

                    player1PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player1213BetText = player1213BetAmount:GetText()

        if player1213BetText and player1213BetText ~= "" then
            player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

            if player1213BetAmountValue then
                if player1213SideBetWin == false then

                    player1213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        player1SessionWin = player1SessionWin + tonumber(player1MainBetValue)

    end
end

function player1SplitH1Push()
    player1SplitHand1BetAmountValue = tonumber(string.match(player1SplitH1BetAmount:GetText(), "%d+"))
    if player1SplitHand1BetAmountValue then

        if playerName == unitName1 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1SplitHand1BetAmountValue)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end
        end

        bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    
        player1SessionWin = player1SessionWin + tonumber(player1SplitHand1BetAmountValue)
    
    end
end

function player1SplitH2Push()
    player1SplitHand2BetAmountValue = tonumber(string.match(player1SplitH2BetAmount:GetText(), "%d+"))
    if player1SplitHand2BetAmountValue then

        if playerName == unitName1 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1SplitHand2BetAmountValue)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end
        end

        bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

        local player1PPBetText = player1PPBetAmount:GetText()

        if player1PPBetText and player1PPBetText ~= "" then
            player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
            
            if player1PPBetAmountValue then
                if player1PPSideBetWin == false then

                    player1PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player1213BetText = player1213BetAmount:GetText()

        if player1213BetText and player1213BetText ~= "" then
            player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

            if player1213BetAmountValue then
                if player1213SideBetWin == false then

                    player1213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    
        player1SessionWin = player1SessionWin + tonumber(player1SplitHand2BetAmountValue)
    
    end
end

function player1BJWin(message)
    player1MainBetAmountValue = tonumber(string.match(player1MainBetAmount:GetText(), "%d+"))
    if player1MainBetAmountValue then
        player1BJWinAmountValue = player1MainBetAmountValue * 2.5
        player1MainBetAmount:SetText(player1BJWinAmountValue .. " G")
    end

    player1BJProfitvalue = player1BJWinAmountValue - player1MainBetAmountValue

    if playerName == unitName1 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player1totalWin = player1totalWin + tonumber(player1BJProfitvalue)
            bankingInfo.totalWon = player1totalWin
            player1totalProfit = player1totalProfit + tonumber(player1BJProfitvalue)
            bankingInfo.totalProfit = player1totalProfit
            player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1BJWinAmountValue)
            bankingInfo.bankrollTable = player1TotalBankrollAmount
        end
    end

    if player1totalProfit >= 0 then
        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
    bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

    local player1PPBetText = player1PPBetAmount:GetText()

    if player1PPBetText and player1PPBetText ~= "" then
        player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
        
        if player1PPBetAmountValue then
            if player1PPSideBetWin == false then

                player1PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName1 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                        bankingInfo.totalLost = player1totalLoss
                        player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                        bankingInfo.totalProfit = player1totalProfit
                    end
                end
        
                historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
        
                if player1totalProfit >= 0 then
                    historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player1213BetText = player1213BetAmount:GetText()

    if player1213BetText and player1213BetText ~= "" then
        player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

        if player1213BetAmountValue then
            if player1213SideBetWin == false then

                player1213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName1 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                        bankingInfo.totalLost = player1totalLoss
                        player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                        bankingInfo.totalProfit = player1totalProfit
                    end
                end
        
                historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
        
                if player1totalProfit >= 0 then
                    historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player1MainBetCoins:Hide()
    playerFrame.player1BJWinCoins:Show()

    player1SessionWin = player1SessionWin + tonumber(player1BJWinAmountValue)

end

function player1SplitH1BJ(message)
    player1SplitHand1BetAmountValue = tonumber(string.match(player1SplitH1BetAmount:GetText(), "%d+"))
    if player1SplitHand1BetAmountValue then
        player1SplitHand1BJWinAmountValue = player1SplitHand1BetAmountValue * 2.5
        player1SplitH1BetAmount:SetText(player1SplitHand1BJWinAmountValue .. " G")
    end

    player1SplitHand1BJProfitValue = player1SplitHand1BJWinAmountValue - player1SplitHand1BetAmountValue

    if playerName == unitName1 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player1totalWin = player1totalWin + tonumber(player1SplitHand1BJProfitValue)
            bankingInfo.totalWon = player1totalWin
            player1totalProfit = player1totalProfit + tonumber(player1SplitHand1BJProfitValue)
            bankingInfo.totalProfit = player1totalProfit
            player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1SplitHand1BJWinAmountValue)
            bankingInfo.bankrollTable = player1TotalBankrollAmount
        end
    end

    if player1totalProfit >= 0 then
        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
    bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

    playerFrame.player1SplitHand1Coins:Hide()
    playerFrame.player1SplitHand1BJWinCoins:Show()

    player1SessionWin = player1SessionWin + tonumber(player1SplitHand1BJWinAmountValue)

end

function player1SplitH2BJ(message)
    player1SplitHand2BetAmountValue = tonumber(string.match(player1SplitH2BetAmount:GetText(), "%d+"))
    if player1SplitHand2BetAmountValue then
        player1SplitHand2BJWinAmountValue = player1SplitHand2BetAmountValue * 2.5
        player1SplitH2BetAmount:SetText(player1SplitHand2BJWinAmountValue .. " G")
    end

    player1SplitHand2BJProfitValue = player1SplitHand2BJWinAmountValue - player1SplitHand2BetAmountValue

    if playerName == unitName1 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player1totalWin = player1totalWin + tonumber(player1SplitHand2BJProfitValue)
            bankingInfo.totalWon = player1totalWin
            player1totalProfit = player1totalProfit + tonumber(player1SplitHand2BJProfitValue)
            bankingInfo.totalProfit = player1totalProfit
            player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1SplitHand2BJWinAmountValue)
            bankingInfo.bankrollTable = player1TotalBankrollAmount
        end
    end

    if player1totalProfit >= 0 then
        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
    bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

    local player1PPBetText = player1PPBetAmount:GetText()

    if player1PPBetText and player1PPBetText ~= "" then
        player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
        
        if player1PPBetAmountValue then
            if player1PPSideBetWin == false then

                player1PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName1 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                        bankingInfo.totalLost = player1totalLoss
                        player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                        bankingInfo.totalProfit = player1totalProfit
                    end
                end
        
                historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
        
                if player1totalProfit >= 0 then
                    historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player1213BetText = player1213BetAmount:GetText()

    if player1213BetText and player1213BetText ~= "" then
        player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

        if player1213BetAmountValue then
            if player1213SideBetWin == false then

                player1213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName1 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                        bankingInfo.totalLost = player1totalLoss
                        player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                        bankingInfo.totalProfit = player1totalProfit
                    end
                end
        
                historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
        
                if player1totalProfit >= 0 then
                    historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player1SplitHand2Coins:Hide()
    playerFrame.player1SplitHand2BJWinCoins:Show()

    player1SessionWin = player1SessionWin + tonumber(player1SplitHand2BJWinAmountValue)

end

function player1Win(message)
    player1MainBetAmountValue = tonumber(string.match(player1MainBetAmount:GetText(), "%d+"))
    if player1MainBetAmountValue then
        player1NormalWinAmountValue = player1MainBetAmountValue * 2
        player1MainBetAmount:SetText(player1NormalWinAmountValue .. " G")

        if playerName == unitName1 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player1totalWin = player1totalWin + tonumber(player1MainBetAmountValue)
                bankingInfo.totalWon = player1totalWin
                player1totalProfit = player1totalProfit + tonumber(player1MainBetAmountValue)
                bankingInfo.totalProfit = player1totalProfit
                player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1NormalWinAmountValue)
                bankingInfo.bankrollTable = player1TotalBankrollAmount
            end
        end
    
        if player1totalProfit >= 0 then
            historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end
    
        historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
        historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
        bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

        local player1PPBetText = player1PPBetAmount:GetText()

        if player1PPBetText and player1PPBetText ~= "" then
            player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
            
            if player1PPBetAmountValue then
                if player1PPSideBetWin == false then

                    player1PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player1213BetText = player1213BetAmount:GetText()

        if player1213BetText and player1213BetText ~= "" then
            player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

            if player1213BetAmountValue then
                if player1213SideBetWin == false then

                    player1213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName1 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                            bankingInfo.totalLost = player1totalLoss
                            player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                            bankingInfo.totalProfit = player1totalProfit
                        end
                    end
            
                    historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            
                    if player1totalProfit >= 0 then
                        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end

    playerFrame.player1MainBetCoins:Hide()
    playerFrame.player1NormalWinCoins:Show()

    player1SessionWin = player1SessionWin + tonumber(player1NormalWinAmountValue)

end

function player1SplitH1Win(message)
    player1SplitHand1BetAmountValue = tonumber(string.match(player1SplitH1BetAmount:GetText(), "%d+"))
    if player1SplitHand1BetAmountValue then
        player1SplitHand1NormalWinAmountValue = player1SplitHand1BetAmountValue * 2
        player1SplitH1BetAmount:SetText(player1SplitHand1NormalWinAmountValue .. " G")
    end

    if playerName == unitName1 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player1totalWin = player1totalWin + tonumber(player1SplitHand1BetAmountValue)
            bankingInfo.totalWon = player1totalWin
            player1totalProfit = player1totalProfit + tonumber(player1SplitHand1BetAmountValue)
            bankingInfo.totalProfit = player1totalProfit
            player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1SplitHand1NormalWinAmountValue)
            bankingInfo.bankrollTable = player1TotalBankrollAmount
        end
    end

    if player1totalProfit >= 0 then
        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
    bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

    playerFrame.player1SplitHand1Coins:Hide()
    playerFrame.player1SplitHand1NormalWinCoins:Show()

    player1SessionWin = player1SessionWin + tonumber(player1SplitHand1NormalWinAmountValue)

end

function player1SplitH2Win(message)
    player1SplitHand2BetAmountValue = tonumber(string.match(player1SplitH2BetAmount:GetText(), "%d+"))
    if player1SplitHand2BetAmountValue then
        player1SplitHand2NormalWinAmountValue = player1SplitHand2BetAmountValue * 2
        player1SplitH2BetAmount:SetText(player1SplitHand2NormalWinAmountValue .. " G")
    end

    if playerName == unitName1 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player1totalWin = player1totalWin + tonumber(player1SplitHand2BetAmountValue)
            bankingInfo.totalWon = player1totalWin
            player1totalProfit = player1totalProfit + tonumber(player1SplitHand2BetAmountValue)
            bankingInfo.totalProfit = player1totalProfit
            player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1SplitHand2NormalWinAmountValue)
            bankingInfo.bankrollTable = player1TotalBankrollAmount
        end
    end

    if player1totalProfit >= 0 then
        historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
    historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
    bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

    local player1PPBetText = player1PPBetAmount:GetText()

    if player1PPBetText and player1PPBetText ~= "" then
        player1PPBetAmountValue = tonumber(string.match(player1PPBetText, "%d+"))
        
        if player1PPBetAmountValue then
            if player1PPSideBetWin == false then

                player1PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName1 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player1totalLoss = player1totalLoss + tonumber(player1PPBetAmountValue)
                        bankingInfo.totalLost = player1totalLoss
                        player1totalProfit = player1totalProfit - tonumber(player1PPBetAmountValue)
                        bankingInfo.totalProfit = player1totalProfit
                    end
                end
        
                historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
        
                if player1totalProfit >= 0 then
                    historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player1213BetText = player1213BetAmount:GetText()

    if player1213BetText and player1213BetText ~= "" then
        player1213BetAmountValue = tonumber(string.match(player1213BetText, "%d+"))

        if player1213BetAmountValue then
            if player1213SideBetWin == false then

                player1213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName1 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player1totalLoss = player1totalLoss + tonumber(player1213BetAmountValue)
                        bankingInfo.totalLost = player1totalLoss
                        player1totalProfit = player1totalProfit - tonumber(player1213BetAmountValue)
                        bankingInfo.totalProfit = player1totalProfit
                    end
                end
        
                historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
                historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
        
                if player1totalProfit >= 0 then
                    historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player1SplitHand2Coins:Hide()
    playerFrame.player1SplitHand2NormalWinCoins:Show()

    player1SessionWin = player1SessionWin + tonumber(player1SplitHand2NormalWinAmountValue)

end

function player1InsuranceWin(message)

    local player1InsuranceBetText = playerFrame.player1InsuranceBetAmount:GetText()

    if player1InsuranceBetText and player1InsuranceBetText ~= "" then
        player1InsuranceBetAmountValue = tonumber(string.match(player1InsuranceBetText, "%d+"))

        if player1InsuranceBetAmountValue then
            player1InsuranceWinAmountValue = player1InsuranceBetAmountValue * 3

            player1InsuranceProfitValue = player1InsuranceWinAmountValue - player1InsuranceBetAmountValue


            if playerName == unitName1 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1totalWin = player1totalWin + tonumber(player1InsuranceProfitValue)
                    bankingInfo.totalWon = player1totalWin
                    player1totalProfit = player1totalProfit + tonumber(player1InsuranceProfitValue)
                    bankingInfo.totalProfit = player1totalProfit
                    player1TotalBankrollAmount = player1TotalBankrollAmount + tonumber(player1InsuranceWinAmountValue)
                    bankingInfo.bankrollTable = player1TotalBankrollAmount
                end
            end
        
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
        
            historyFrame.player1totalWonAmount:SetText(player1totalWin .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")
            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")

            player1SessionWin = player1SessionWin + tonumber(player1InsuranceWinAmountValue)

        end
    end
end

function player1InsuranceLoss(message)

    local player1InsuranceBetText = playerFrame.player1InsuranceBetAmount:GetText()

    if player1InsuranceBetText and player1InsuranceBetText ~= "" then
        player1InsuranceBetAmountValue = tonumber(string.match(player1InsuranceBetText, "%d+"))

        if player1InsuranceBetAmountValue then

            if playerName == unitName1 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player1totalLoss = player1totalLoss + tonumber(player1InsuranceBetAmountValue)
                    bankingInfo.totalLost = player1totalLoss
                    player1totalProfit = player1totalProfit - tonumber(player1InsuranceBetAmountValue)
                    bankingInfo.totalProfit = player1totalProfit
                end
            end
    
            if player1totalProfit >= 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
    
            historyFrame.player1totalLostAmount:SetText(player1totalLoss .. " G")
            historyFrame.player1ProfitAmount:SetText(player1totalProfit .. " G")

        end
    end
end

local function player1SessionWinAnnouncement()
    if playerName == unitName1 then
        if player1SessionWinCalled == false then
            if player1SessionWin >= 2 then
                local chatFrame = SELECTED_DOCK_FRAME
                ChatFrame_OpenChat("/me", chatFrame)
                
                local editBox = _G[chatFrame:GetName().."EditBox"]
                editBox:SetText("")
                editBox:Insert("/me has won " .. player1SessionWin .. "g from a hand of Blackjack.")
                
                ChatEdit_SendText(editBox)
                ChatEdit_DeactivateChat(editBox)

                UpdateWinningsDisplay(playerFrame.player1WinningsUpdate, player1SessionWin)
                player1resetRaidChannel()
                
            else
                print("")
            end

            player1SessionWinCalled = true
        end
    end
end




















-- >>> PLAYER 2 <<<
-- >>> PLAYER 2 <<<
-- >>> PLAYER 2 <<<

playerFrame.player2CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 210, 230)
playerFrame.player2CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 28, "OUTLINE") -- Adjust the font and size as needed
playerFrame.player2CardTotalText:SetText("")

playerFrame.player2SplitHand1CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2SplitHand1CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 247, 247)
playerFrame.player2SplitHand1CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player2SplitHand1CardTotalText:SetText("")

playerFrame.player2SplitHand2CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2SplitHand2CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 187, 224)
playerFrame.player2SplitHand2CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player2SplitHand2CardTotalText:SetText("")

-- Buttons for Player 2
-- Hit
playerFrame.player2HitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2HitButton:SetPoint("BOTTOM", playerFrame, 222, 127)
playerFrame.player2HitButton:SetSize(65, 30)
playerFrame.player2HitButton:SetText("Hit")
playerFrame.player2HitButton:Disable()
playerFrame.player2HitButton:Hide()
-- Stand
playerFrame.player2StandButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2StandButton:SetPoint("BOTTOM", playerFrame, 288, 127)
playerFrame.player2StandButton:SetSize(65, 30)
playerFrame.player2StandButton:SetText("Stand")
playerFrame.player2StandButton:Disable()
playerFrame.player2StandButton:Hide()
-- Double
playerFrame.player2DoubleButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2DoubleButton:SetPoint("BOTTOM", playerFrame, 222, 97)
playerFrame.player2DoubleButton:SetSize(65, 30)
playerFrame.player2DoubleButton:SetText("Double")
playerFrame.player2DoubleButton:Disable()
playerFrame.player2DoubleButton:Hide()
-- Split
playerFrame.player2SplitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2SplitButton:SetPoint("BOTTOM", playerFrame, 288, 97)
playerFrame.player2SplitButton:SetSize(65, 30)
playerFrame.player2SplitButton:SetText("Split")
playerFrame.player2SplitButton:Disable()
playerFrame.player2SplitButton:Hide()
-- Insurance Yes
playerFrame.player2InsuranceYesButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2InsuranceYesButton:SetPoint("BOTTOM", playerFrame, 190, 67)
playerFrame.player2InsuranceYesButton:SetSize(55, 30)
playerFrame.player2InsuranceYesButton:SetText("Yes")
playerFrame.player2InsuranceYesButton:Disable()
playerFrame.player2InsuranceYesButton:Hide()
-- Insurance No
playerFrame.player2InsuranceNoButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2InsuranceNoButton:SetPoint("BOTTOM", playerFrame, 318, 67)
playerFrame.player2InsuranceNoButton:SetSize(55, 30)
playerFrame.player2InsuranceNoButton:SetText("No")
playerFrame.player2InsuranceNoButton:Disable()
playerFrame.player2InsuranceNoButton:Hide()
-- Deal Now
playerFrame.player2DealNowButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2DealNowButton:SetPoint("BOTTOM", playerFrame, 255, 67)
playerFrame.player2DealNowButton:SetSize(85, 30)
playerFrame.player2DealNowButton:SetText("Deal Now")
playerFrame.player2DealNowButton:Disable()
playerFrame.player2DealNowButton:Hide()
-- Hit (Split H1)
playerFrame.player2HitButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2HitButtonSplitH1:SetPoint("BOTTOM", playerFrame, 288, 127)
playerFrame.player2HitButtonSplitH1:SetSize(65, 30)
playerFrame.player2HitButtonSplitH1:SetText("Hit")
playerFrame.player2HitButtonSplitH1:Disable()
playerFrame.player2HitButtonSplitH1:Hide()
-- Stand (Split H1)
playerFrame.player2StandButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2StandButtonSplitH1:SetPoint("BOTTOM", playerFrame, 288, 97)
playerFrame.player2StandButtonSplitH1:SetSize(65, 30)
playerFrame.player2StandButtonSplitH1:SetText("Stand")
playerFrame.player2StandButtonSplitH1:Disable()
playerFrame.player2StandButtonSplitH1:Hide()
-- Double (Split H1)
playerFrame.player2DoubleButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2DoubleButtonSplitH1:SetPoint("BOTTOM", playerFrame, 288, 67)
playerFrame.player2DoubleButtonSplitH1:SetSize(65, 30)
playerFrame.player2DoubleButtonSplitH1:SetText("Double")
playerFrame.player2DoubleButtonSplitH1:Disable()
playerFrame.player2DoubleButtonSplitH1:Hide()
-- Hit (Split H2)
playerFrame.player2HitButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2HitButtonSplitH2:SetPoint("BOTTOM", playerFrame, 222, 127)
playerFrame.player2HitButtonSplitH2:SetSize(65, 30)
playerFrame.player2HitButtonSplitH2:SetText("Hit")
playerFrame.player2HitButtonSplitH2:Disable()
playerFrame.player2HitButtonSplitH2:Hide()
-- Stand (Split H2)
playerFrame.player2StandButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2StandButtonSplitH2:SetPoint("BOTTOM", playerFrame, 222, 97)
playerFrame.player2StandButtonSplitH2:SetSize(65, 30)
playerFrame.player2StandButtonSplitH2:SetText("Stand")
playerFrame.player2StandButtonSplitH2:Disable()
playerFrame.player2StandButtonSplitH2:Hide()
-- Double (Split H2)
playerFrame.player2DoubleButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player2DoubleButtonSplitH2:SetPoint("BOTTOM", playerFrame, 222, 67)
playerFrame.player2DoubleButtonSplitH2:SetSize(65, 30)
playerFrame.player2DoubleButtonSplitH2:SetText("Double")
playerFrame.player2DoubleButtonSplitH2:Disable()
playerFrame.player2DoubleButtonSplitH2:Hide()
-- Main Bet Confirm
player2ConfirmMainBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player2ConfirmMainBetButton:SetPoint("BOTTOM", playerFrame, 288, 187)
player2ConfirmMainBetButton:SetSize(65, 30)
player2ConfirmMainBetButton:SetText("Bet")
player2ConfirmMainBetButton:Hide()
-- Perfect Pairs Confirm
player2ConfirmPPBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player2ConfirmPPBetButton:SetPoint("BOTTOM", playerFrame, 129, 244)
player2ConfirmPPBetButton:SetSize(43, 25)
player2ConfirmPPBetButton:SetText("Bet")
player2ConfirmPPBetButton:Hide()
-- 21+3 Confirm
player2Confirm213BetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player2Confirm213BetButton:SetPoint("BOTTOM", playerFrame, 245, 295)
player2Confirm213BetButton:SetSize(43, 25)
player2Confirm213BetButton:SetText("Bet")
player2Confirm213BetButton:Hide()

-- Wagers for Player 2
-- Main Bet
player2MainBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player2MainBetEditBox:SetSize(55, 30)
player2MainBetEditBox:SetPoint("BOTTOM", playerFrame, 225, 187)
player2MainBetEditBox:SetAutoFocus(false)
player2MainBetEditBox:SetNumeric(true)
player2MainBetEditBox:Hide()
-- Split Hand 1
player2SplitH1EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player2SplitH1EditBox:SetSize(55, 30)
player2SplitH1EditBox:SetPoint("BOTTOM", playerFrame, 290, 187)
player2SplitH1EditBox:SetAutoFocus(false)
player2SplitH1EditBox:SetNumeric(true)
player2SplitH1EditBox:ClearFocus()
player2SplitH1EditBox:Disable()
player2SplitH1EditBox:Hide()
-- Split Hand 2
player2SplitH2EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player2SplitH2EditBox:SetSize(55, 30)
player2SplitH2EditBox:SetPoint("BOTTOM", playerFrame, 225, 187)
player2SplitH2EditBox:SetAutoFocus(false)
player2SplitH2EditBox:SetNumeric(true)
player2SplitH2EditBox:ClearFocus()
player2SplitH2EditBox:Disable()
player2SplitH2EditBox:Hide()
-- Perfect Pairs
player2PPBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player2PPBetEditBox:SetSize(35, 30)
player2PPBetEditBox:SetPoint("BOTTOM", playerFrame, 132, 264)
player2PPBetEditBox:SetAutoFocus(false)
player2PPBetEditBox:SetNumeric(true)
player2PPBetEditBox:Hide()
-- 21+3
player2213BetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player2213BetEditBox:SetSize(35, 30)
player2213BetEditBox:SetPoint("BOTTOM", playerFrame, 247, 315)
player2213BetEditBox:SetAutoFocus(false)
player2213BetEditBox:SetNumeric(true)
player2213BetEditBox:Hide()

-- Labels for Player 2
-- Main Bet
playerFrame.player2MainBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2MainBetTitle:SetPoint("BOTTOM", playerFrame, 224, 214)
playerFrame.player2MainBetTitle:SetJustifyH("CENTER")
playerFrame.player2MainBetTitle:SetText("Main Bet")
playerFrame.player2MainBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player2MainBetTitle:Hide()
-- Split Hand 1
playerFrame.player2SplitH1Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2SplitH1Title:SetPoint("BOTTOM", playerFrame, 289, 214)
playerFrame.player2SplitH1Title:SetJustifyH("CENTER")
playerFrame.player2SplitH1Title:SetText("Hand 1")
playerFrame.player2SplitH1Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player2SplitH1Title:Hide()
-- Split Hand 2
playerFrame.player2SplitH2Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2SplitH2Title:SetPoint("BOTTOM", playerFrame, 224, 214)
playerFrame.player2SplitH2Title:SetJustifyH("CENTER")
playerFrame.player2SplitH2Title:SetText("Hand 2")
playerFrame.player2SplitH2Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player2SplitH2Title:Hide()
-- Main Bet Amount
player2MainBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2MainBetAmount:SetPoint("CENTER", playerFrame, 189, -16)
player2MainBetAmount:SetJustifyH("CENTER")
player2MainBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 1 Amount
player2SplitH1BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2SplitH1BetAmount:SetPoint("CENTER", playerFrame, 203, -9)
player2SplitH1BetAmount:SetJustifyH("CENTER")
player2SplitH1BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 2 Amount
player2SplitH2BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2SplitH2BetAmount:SetPoint("CENTER", playerFrame, 174, -24)
player2SplitH2BetAmount:SetJustifyH("CENTER")
player2SplitH2BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Perfect Pairs
playerFrame.player2PPBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2PPBetTitle:SetPoint("BOTTOM", playerFrame, 96, 262)
playerFrame.player2PPBetTitle:SetJustifyH("CENTER")
playerFrame.player2PPBetTitle:SetText("PP")
playerFrame.player2PPBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player2PPBetTitle:Hide()
-- Perfect Pairs Amount
player2PPBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2PPBetAmount:SetPoint("CENTER", playerFrame, 123, -23)
player2PPBetAmount:SetJustifyH("CENTER")
player2PPBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- 21+3
playerFrame.player2213BetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2213BetTitle:SetPoint("BOTTOM", playerFrame, 290, 312)
playerFrame.player2213BetTitle:SetJustifyH("CENTER")
playerFrame.player2213BetTitle:SetText("21+3")
playerFrame.player2213BetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player2213BetTitle:Hide()
-- 21+3 Amount
player2213BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player2213BetAmount:SetPoint("CENTER", playerFrame, 231, 29)
player2213BetAmount:SetJustifyH("CENTER")
player2213BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Insurance Amount
playerFrame.player2InsuranceBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2InsuranceBetAmount:SetPoint("CENTER", playerFrame, 364, -258)
playerFrame.player2InsuranceBetAmount:SetJustifyH("CENTER")
playerFrame.player2InsuranceBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE")
-- Player Name
playerFrame.player2Name = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2Name:SetPoint("BOTTOM", playerFrame, 255, 163)
playerFrame.player2Name:SetText("Seat Empty")
playerFrame.player2Name:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
-- Insurance Bet
playerFrame.player2InsuranceTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2InsuranceTitle:SetPoint("BOTTOM", playerFrame, 255, 81)
playerFrame.player2InsuranceTitle:SetText("Insurance")
playerFrame.player2InsuranceTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
playerFrame.player2InsuranceTitle:Hide()
-- Insurance (if available)
playerFrame.player2InsuranceSubtitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2InsuranceSubtitle:SetPoint("BOTTOM", playerFrame, 255, 71)
playerFrame.player2InsuranceSubtitle:SetText("(if available)")
playerFrame.player2InsuranceSubtitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player2InsuranceSubtitle:Hide()
-- Session Win Update
playerFrame.player2WinningsUpdate = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player2WinningsUpdate:SetPoint("BOTTOMLEFT", playerFrame, 270, 30) 
playerFrame.player2WinningsUpdate:SetText("")
playerFrame.player2WinningsUpdate:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
playerFrame.player2WinningsUpdate:SetTextColor(0.118, 0.839, 0.412)

-- Images for Player 2
-- Turn Arrow
playerFrame.player2TurnArrow = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2TurnArrow:SetSize(128, 128)
playerFrame.player2TurnArrow:SetPoint("CENTER", playerFrame, 362, -165)
playerFrame.player2TurnArrow:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\TurnArrow.tga")
playerFrame.player2TurnArrow:SetBlendMode("BLEND")
playerFrame.player2TurnArrow:SetDrawLayer("OVERLAY")
playerFrame.player2TurnArrow:Hide()
-- Main Bet
playerFrame.player2MainBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2MainBetCoins:SetSize(128, 128)
playerFrame.player2MainBetCoins:SetPoint("CENTER", playerFrame, 206, -47)
playerFrame.player2MainBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player2MainBetCoins:SetBlendMode("BLEND")
playerFrame.player2MainBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player2MainBetCoins:Hide()
-- Win
playerFrame.player2NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2NormalWinCoins:SetSize(128, 128)
playerFrame.player2NormalWinCoins:SetPoint("CENTER", playerFrame, 206, -47)
playerFrame.player2NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player2NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player2NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2NormalWinCoins:Hide()
-- Split Hand 2 Bet
playerFrame.player2SplitHand2Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand2Coins:SetSize(128, 128)
playerFrame.player2SplitHand2Coins:SetPoint("CENTER", playerFrame, 190, -55)
playerFrame.player2SplitHand2Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player2SplitHand2Coins:SetBlendMode("BLEND")
playerFrame.player2SplitHand2Coins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand2Coins:Hide()
-- Split Double Hand 2 Bet
playerFrame.player2SplitHand2DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand2DoubleCoins:SetSize(128, 128)
playerFrame.player2SplitHand2DoubleCoins:SetPoint("CENTER", playerFrame, 196, -59)
playerFrame.player2SplitHand2DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player2SplitHand2DoubleCoins:SetBlendMode("BLEND")
playerFrame.player2SplitHand2DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand2DoubleCoins:Hide()
-- Split Win Hand 2
playerFrame.player2SplitHand2NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand2NormalWinCoins:SetSize(128, 128)
playerFrame.player2SplitHand2NormalWinCoins:SetPoint("CENTER", playerFrame, 196, -59)
playerFrame.player2SplitHand2NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player2SplitHand2NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player2SplitHand2NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand2NormalWinCoins:Hide()
-- Split Hand 1 Bet
playerFrame.player2SplitHand1Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand1Coins:SetSize(128, 128)
playerFrame.player2SplitHand1Coins:SetPoint("CENTER", playerFrame, 220, -40)
playerFrame.player2SplitHand1Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player2SplitHand1Coins:SetBlendMode("BLEND")
playerFrame.player2SplitHand1Coins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand1Coins:Hide()
-- Split Double Hand 1 Bet
playerFrame.player2SplitHand1DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand1DoubleCoins:SetSize(128, 128)
playerFrame.player2SplitHand1DoubleCoins:SetPoint("CENTER", playerFrame, 223, -34)
playerFrame.player2SplitHand1DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player2SplitHand1DoubleCoins:SetBlendMode("BLEND")
playerFrame.player2SplitHand1DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand1DoubleCoins:Hide()
-- Split Win Hand 1
playerFrame.player2SplitHand1NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand1NormalWinCoins:SetSize(128, 128)
playerFrame.player2SplitHand1NormalWinCoins:SetPoint("CENTER", playerFrame, 223, -34)
playerFrame.player2SplitHand1NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player2SplitHand1NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player2SplitHand1NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand1NormalWinCoins:Hide()
-- Blackjack Win
playerFrame.player2BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2BJWinCoins:SetSize(128, 128)
playerFrame.player2BJWinCoins:SetPoint("CENTER", playerFrame, 206, -47)
playerFrame.player2BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player2BJWinCoins:SetBlendMode("BLEND")
playerFrame.player2BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2BJWinCoins:Hide()
-- Split BJ Win Hand 2
playerFrame.player2SplitHand2BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand2BJWinCoins:SetSize(128, 128)
playerFrame.player2SplitHand2BJWinCoins:SetPoint("CENTER", playerFrame, 196, -59)
playerFrame.player2SplitHand2BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player2SplitHand2BJWinCoins:SetBlendMode("BLEND")
playerFrame.player2SplitHand2BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand2BJWinCoins:Hide()
-- Split BJ Win Hand 1
playerFrame.player2SplitHand1BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2SplitHand1BJWinCoins:SetSize(128, 128)
playerFrame.player2SplitHand1BJWinCoins:SetPoint("CENTER", playerFrame, 223, -34)
playerFrame.player2SplitHand1BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player2SplitHand1BJWinCoins:SetBlendMode("BLEND")
playerFrame.player2SplitHand1BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2SplitHand1BJWinCoins:Hide()
-- Double Bet
playerFrame.player2DoubleBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2DoubleBetCoins:SetSize(128, 128)
playerFrame.player2DoubleBetCoins:SetPoint("CENTER", playerFrame, 206, -47)
playerFrame.player2DoubleBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player2DoubleBetCoins:SetBlendMode("BLEND")
playerFrame.player2DoubleBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player2DoubleBetCoins:Hide()
-- PP Bet
playerFrame.player2PPBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2PPBetCoins:SetSize(128, 128)
playerFrame.player2PPBetCoins:SetPoint("CENTER", playerFrame, 127, -42)
playerFrame.player2PPBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player2PPBetCoins:SetBlendMode("BLEND")
playerFrame.player2PPBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player2PPBetCoins:Hide()
-- 21+3 Bet
playerFrame.player2213BetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2213BetCoins:SetSize(128, 128)
playerFrame.player2213BetCoins:SetPoint("CENTER", playerFrame, 235, 8)
playerFrame.player2213BetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player2213BetCoins:SetBlendMode("BLEND")
playerFrame.player2213BetCoins:SetDrawLayer("OVERLAY")
playerFrame.player2213BetCoins:Hide()
-- PP Win
playerFrame.player2PPWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2PPWinCoins:SetSize(128, 128)
playerFrame.player2PPWinCoins:SetPoint("CENTER", playerFrame, 138, -36)
playerFrame.player2PPWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player2PPWinCoins:SetBlendMode("BLEND")
playerFrame.player2PPWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2PPWinCoins:Hide()
-- 21+3 Win
playerFrame.player2213WinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player2213WinCoins:SetSize(128, 128)
playerFrame.player2213WinCoins:SetPoint("CENTER", playerFrame, 246, 16)
playerFrame.player2213WinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player2213WinCoins:SetBlendMode("BLEND")
playerFrame.player2213WinCoins:SetDrawLayer("OVERLAY")
playerFrame.player2213WinCoins:Hide()
-- Insurance YES for Player 2
player2InsuranceYesIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player2InsuranceYesIcon:SetSize(24, 24)
player2InsuranceYesIcon:SetPoint("CENTER", playerFrame, 361, -278)
player2InsuranceYesIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceYes.tga")
player2InsuranceYesIcon:SetDrawLayer("OVERLAY")
player2InsuranceYesIcon:Hide()
-- Insurance NO for Player 2
player2InsuranceNoIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player2InsuranceNoIcon:SetSize(24, 24)
player2InsuranceNoIcon:SetPoint("CENTER", playerFrame, 361, -278)
player2InsuranceNoIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceNo.tga")
player2InsuranceNoIcon:SetDrawLayer("OVERLAY")
player2InsuranceNoIcon:Hide()

-- BJ Win Coins
local function player2PlaceCoinsBJWin(message)
    playerFrame.player2MainBetCoins:Hide()
    playerFrame.player2BJWinCoins:Show()
end

-- Regular Win Coins
local function player2PlaceCoinsRegularWin(message)
    playerFrame.player2MainBetCoins:Hide()
    playerFrame.player2DoubleBetCoins:Show()
end

-- Main Bet Coins
local function player2PlaceCoinsMainBet(message)
    playerFrame.player2MainBetCoins:Show()
end

-- Double Bet Coins
local function player2PlaceCoinsDoubleBet(message)
    playerFrame.player2MainBetCoins:Hide()
    playerFrame.player2DoubleBetCoins:Show()
end

-- Function to handle Player 2 Main Bet Text
local function player2PlaceTextMainBet(message)
    local player2HistoryMainBet = string.match(message, "(%d+)G")

        if player2HistoryMainBet then
            player2MainBetAmount:SetText(player2HistoryMainBet .. " G")
            player2MainBetAmount:Show()

            if playerName == unitName2 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName2]
                    player2totalBetAmount = player2totalBetAmount + tonumber(player2HistoryMainBet)
                    bankingInfo.totalWagered = player2totalBetAmount
                end
            end

            historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")

        else
    end
end

-- Player 2 Split Hand Bet Text
function player2SplitHand1BetText(Amount)
    player2MainBetAmount:Hide()
    player2MainBetAmount:SetText("")
    player2SplitH1BetAmount:SetText(Amount .. " G")
    player2SplitH1BetAmount:Show()
    player2SplitH2BetAmount:SetText(Amount .. " G")
    player2SplitH2BetAmount:Show()
end

-- Player 2 Split Bet Image
function player2PlaceSplitBet(message)
    playerFrame.player2MainBetCoins:Hide()
    playerFrame.player2SplitHand1Coins:Show()
    playerFrame.player2SplitHand2Coins:Show()
end

-- Player 2 Place Initial Card Images
function player2PlaceSplitCards(message)

    -- Players: 2
    if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[3]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[3]
        turn = 8 -- Player 2: 2nd Card (Split H1)

    -- Players: 1, 2
    elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[5]
        turn = 30 -- Player 2: 2nd Card (Split H1)
    -- Players: 2, 3
    elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[4]
        turn = 10 -- Player 2: 2nd Card (Split H1)
    -- Players: 2, 4
    elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[4]
        turn = 10 -- Player 2: 2nd Card (Split H1)
    -- Players: 2, 5
    elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[4]
        turn = 10 -- Player 2: 2nd Card (Split H1)
        
    -- Players: 1, 2, 3
    elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[6]
        turn = 32 -- Player 2: 2nd Card (Split H1)
    -- Players: 1, 2, 4
    elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[6]
        turn = 32 -- Player 2: 2nd Card (Split H1)
    -- Players: 1, 2, 5
    elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[6]
        turn = 32 -- Player 2: 2nd Card (Split H1)
    -- Players: 2, 3, 4
    elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[5]
        turn = 12 -- Player 2: 2nd Card (Split H1)
    -- Players: 2, 3, 5
    elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[5]
        turn = 12 -- Player 2: 2nd Card (Split H1)
    -- Players: 2, 4, 5
    elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[5]
        turn = 12 -- Player 2: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4
    elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[2]:Hide()
        drawnCards[7]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[7]
        turn = 34 -- Player 2: 2nd Card (Split H1)
    -- Players: 1, 2, 3, 5
    elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[7]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[7]
        turn = 34 -- Player 2: 2nd Card (Split H1)
    -- Players: 1, 2, 4, 5
    elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[7]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[7]
        turn = 34 -- Player 2: 2nd Card (Split H1)
    -- Players: 2, 3, 4, 5
    elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[6]:Hide()
        player2cardName1 = dealtCards[1]
        player2cardName2 = dealtCards[6]
        turn = 14 -- Player 2: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4, 5
    elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[8]:Hide()
        player2cardName1 = dealtCards[2]
        player2cardName2 = dealtCards[8]
        turn = 36 -- Player 2: 2nd Card (Split H1)

    end

    player2cardImageFile1 = nil
    player2cardImageFile2 = nil

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player2cardName1 then
            player2cardImageFile1 = filename
            break
        end
    end

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player2cardName2 then
            player2cardImageFile2 = filename
            break
        end
    end

    player2NewCardImage1 = CreateFrame("Frame", nil, playerFrame)
    player2NewCardImage1:SetSize(32, 64)
    player2NewCardImage1:SetPoint("BOTTOM", playerFrame, 185, 350)
    player2NewCardImage1.texture = player2NewCardImage1:CreateTexture()
    player2NewCardImage1.texture:SetAllPoints()
    player2NewCardImage1.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2cardImageFile1)
    player2NewCardImage1:Show()

    player2NewCardImage2 = CreateFrame("Frame", nil, playerFrame)
    player2NewCardImage2:SetSize(32, 64)
    player2NewCardImage2:SetPoint("BOTTOM", playerFrame, 143, 330)
    player2NewCardImage2.texture = player2NewCardImage2:CreateTexture()
    player2NewCardImage2.texture:SetAllPoints()
    player2NewCardImage2.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2cardImageFile2)
    player2NewCardImage2:Show()

end

-- Player 2 Split Function
function player2HandleSplit(message)
    player2PlaceSplitBet()
    local player2MainBetAmountValue = tonumber(string.match(player2MainBetAmount:GetText(), "%d+"))
    if player2MainBetAmountValue then
        player2SplitHand1BetText(player2MainBetAmountValue)
    end 

    player2PlaceSplitCards()

    -- A,A
    if playerFrame.player2CardTotalText:GetText() == "2 or 12" then
        playerFrame.player2SplitHand1CardTotalText:SetText("1 or 11")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("1 or 11")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 2,2
    elseif playerFrame.player2CardTotalText:GetText() == "4" then
        playerFrame.player2SplitHand1CardTotalText:SetText("2")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("2")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 3,3
    elseif playerFrame.player2CardTotalText:GetText() == "6" then
        playerFrame.player2SplitHand1CardTotalText:SetText("3")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("3")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 4,4
    elseif playerFrame.player2CardTotalText:GetText() == "8" then
        playerFrame.player2SplitHand1CardTotalText:SetText("4")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("4")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 5,5
    elseif playerFrame.player2CardTotalText:GetText() == "10" then
        playerFrame.player2SplitHand1CardTotalText:SetText("5")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("5")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 6,6
    elseif playerFrame.player2CardTotalText:GetText() == "12" then
        playerFrame.player2SplitHand1CardTotalText:SetText("6")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("6")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 7,7
    elseif playerFrame.player2CardTotalText:GetText() == "14" then
        playerFrame.player2SplitHand1CardTotalText:SetText("7")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("7")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 8,8
    elseif playerFrame.player2CardTotalText:GetText() == "16" then
        playerFrame.player2SplitHand1CardTotalText:SetText("8")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("8")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 9,9
    elseif playerFrame.player2CardTotalText:GetText() == "18" then
        playerFrame.player2SplitHand1CardTotalText:SetText("9")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("9")
        playerFrame.player2SplitHand2CardTotalText:Show()
    -- 10,10
    elseif playerFrame.player2CardTotalText:GetText() == "20" then
        playerFrame.player2SplitHand1CardTotalText:SetText("10")
        playerFrame.player2SplitHand1CardTotalText:Show()
        playerFrame.player2SplitHand2CardTotalText:SetText("10")
        playerFrame.player2SplitHand2CardTotalText:Show()
    end

    playerFrame.player2CardTotalText:SetText("")
    playerFrame.player2CardTotalText:Hide()
    
    if playerName == unitName2 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player2totalBetAmount = player2totalBetAmount + tonumber(player2MainBetAmountValue)
            bankingInfo.totalWagered = player2totalBetAmount
            player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2MainBetAmountValue)
            bankingInfo.bankrollTable = player2TotalBankrollAmount
        end
    end

    historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")
    bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

    player2SplitToggle = true

    if player2dealtCardsFrame:IsShown() then
        player2dealtCardsFrame:Hide()
        player2dealtCardsFrame.playerCardsButton:Hide()
        player2dealtCardsFrameSplitH1:Show()
        player2dealtCardsFrameSplitH1.playerH1CardsButton:Show()
        player2dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    end

end

-- Function to handle Player 2 PP Bet Image
local function player2PlaceCoinsPPBet(message)
    playerFrame.player2PPBetCoins:Show()
end

-- Function to handle Player 2 PP Bet Text
local function player2PlaceTextPPBet(message)
    local player2HistoryPPBet = string.match(message, "(%d+)G")

        if player2HistoryPPBet then
            player2PPBetAmount:SetText(player2HistoryPPBet .. " G")
            player2PPBetAmount:Show()

            if playerName == unitName2 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName2]
                    player2totalBetAmount = player2totalBetAmount + tonumber(player2HistoryPPBet)
                    bankingInfo.totalWagered = player2totalBetAmount
                end
            end

            historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")

        else
    end
end

-- Function to handle Player 2 21+3 Bet Image
local function player2PlaceCoins213Bet(message)
    playerFrame.player2213BetCoins:Show()
end

-- Function to handle Player 2 21+3 Bet Text
local function player2PlaceText213Bet(message)
    local player2History213Bet = string.match(message, "(%d+)G")

        if player2History213Bet then
            player2213BetAmount:SetText(player2History213Bet .. " G")
            player2213BetAmount:Show()

            if playerName == unitName2 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName2]
                    player2totalBetAmount = player2totalBetAmount + tonumber(player2History213Bet)
                    bankingInfo.totalWagered = player2totalBetAmount
                end
            end

            historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")

        else
    end
end

local function player2PreloadBet()
    
    player2MainBet = tonumber(player2PreloadEditBoxMainBet:GetText()) or 0
    player2PPBet = tonumber(player2PreloadEditBoxPPBet:GetText()) or 0
    player2213Bet = tonumber(player2PreloadEditBox213Bet:GetText()) or 0

    player2TotalRebetAmount = player2MainBet + player2PPBet + player2213Bet

    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2currentBankroll - player2TotalRebetAmount < 0 then
        print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
    else
        local player2Threshold = minBetMain - 1
        if player2MainBet <= player2Threshold then
            print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
        else
            if player2MainBet and player2MainBet >= minBetMain and player2MainBet <= maxBetMain then
                PlaySoundFile(soundFilePaths[33])
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P2] Placing a " ..player2MainBet.. "G main bet.", "RAID")
                -- Disable the edit box and button
                player2PreloadEditBoxMainBet:SetFocus(false)
                player2PreloadEditBoxMainBet:ClearFocus()
                player2MainBetEditBox:SetText("")
                player2MainBetEditBox:SetText(player2MainBet)
                player2MainBetEditBox:SetFocus(false)
                player2MainBetEditBox:ClearFocus()
                player2MainBetEditBox:Disable()
                player2ConfirmMainBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2MainBet)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end
            end

            if player2PPBet and player2PPBet >= minBetPP and player2PPBet <= maxBetPP then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P2] Placing a " ..player2PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player2PreloadEditBoxPPBet:SetFocus(false)
                player2PreloadEditBoxPPBet:ClearFocus()
                player2PPBetEditBox:SetText("")
                player2PPBetEditBox:SetText(player2PPBet)
                player2PPBetEditBox:SetFocus(false)
                player2PPBetEditBox:ClearFocus()
                player2PPBetEditBox:Disable()
                player2ConfirmPPBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2PPBet)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end
            end

            if player2213Bet and player2213Bet >= minBet213 and player2213Bet <= maxBet213 then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P2] Placing a " ..player2213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player2PreloadEditBox213Bet:SetFocus(false)
                player2PreloadEditBox213Bet:ClearFocus()
                player2213BetEditBox:SetText("")
                player2213BetEditBox:SetText(player2213Bet)
                player2213BetEditBox:SetFocus(false)
                player2213BetEditBox:ClearFocus()
                player2213BetEditBox:Disable()
                player2Confirm213BetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2213Bet)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end
            end
            
            player2PreloadBetButton:Disable()

        end

        bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

    end

end

-- Function to handle the Player 1 Main "Bet" button click
local function player2ConfirmMainBetClick()
    player2MainBet = tonumber(player2MainBetEditBox:GetText())
    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2MainBet and player2MainBet >= minBetMain and player2MainBet <= maxBetMain then
        if player2currentBankroll - player2MainBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            -- Valid bet amount, send the message with the bet
            SendChatMessage("[P2] Placing a " ..player2MainBet.. "G main bet.", "RAID")
            -- Disable the edit box and button
            player2MainBetEditBox:SetFocus(false)
            player2MainBetEditBox:ClearFocus()
            player2MainBetEditBox:Disable()
            player2ConfirmMainBetButton:Disable()

            player2PreloadBetButton:Disable()

            PlaySoundFile(soundFilePaths[33]) 

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2MainBet)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetMain .. "G and " .. maxBetMain .. "G.")
    end

end

-- Function to handle the Player 1 PP "Bet" button click
local function player2ConfirmPPBetClick()
    player2PPBet = tonumber(player2PPBetEditBox:GetText()) -- Get the entered bet amount
    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2PPBet and player2PPBet >= minBetPP and player2PPBet <= maxBetPP then
        if player2currentBankroll - player2PPBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player2Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P2] Placing a " ..player2PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player2PPBetEditBox:SetFocus(false)
                player2PPBetEditBox:ClearFocus()
                player2PPBetEditBox:Disable()
                player2ConfirmPPBetButton:Disable()

                player2PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2PPBet)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end

                bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
                cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetPP .. "G and " .. maxBetPP .. "G.")
    end

end

-- Function to handle the Player 1 21+3 "Bet" button click
local function player2Confirm213BetClick()
    player2213Bet = tonumber(player2213BetEditBox:GetText()) -- Get the entered bet amount
    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2213Bet and player2213Bet >= minBet213 and player2213Bet <= maxBet213 then
        if player2currentBankroll - player2213Bet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player2Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P2] Placing a " ..player2213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player2213BetEditBox:SetFocus(false)
                player2213BetEditBox:ClearFocus()
                player2213BetEditBox:Disable()
                player2Confirm213BetButton:Disable()

                player2PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2213Bet)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end

                bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
                cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBet213 .. "G and " .. maxBet213 .. "G.")
    end
 
end

-- Player 2 Main "Bet" button
player2ConfirmMainBetButton:SetScript("OnClick", player2ConfirmMainBetClick)

-- Player 2 PP "Bet" button
player2ConfirmPPBetButton:SetScript("OnClick", player2ConfirmPPBetClick)

-- Player 2 21+3 "Bet" button
player2Confirm213BetButton:SetScript("OnClick", player2Confirm213BetClick)

-- Player 2 "Bet All" Preload button
player2PreloadBetButton:SetScript("OnClick", player2PreloadBet)

local function player2resetRaidChannel()
    if playerName == unitName2 then
        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/raid", chatFrame)
        
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:SetText("")
        editBox:Insert("/raid")
        
        ChatEdit_SendText(editBox)
        ChatEdit_DeactivateChat(editBox)
    else
        print("")
    end
end

player2HotstreakImage1 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage1:SetSize(36, 36)
player2HotstreakImage1:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak1.tga")
player2HotstreakImage1:SetDrawLayer("OVERLAY")
player2HotstreakImage1:Hide()

player2HotstreakImage2 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage2:SetSize(36, 36)
player2HotstreakImage2:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak2.tga")
player2HotstreakImage2:SetDrawLayer("OVERLAY")
player2HotstreakImage2:Hide()

player2HotstreakImage3 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage3:SetSize(36, 36)
player2HotstreakImage3:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak3.tga")
player2HotstreakImage3:SetDrawLayer("OVERLAY")
player2HotstreakImage3:Hide()

player2HotstreakImage4 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage4:SetSize(36, 36)
player2HotstreakImage4:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak4.tga")
player2HotstreakImage4:SetDrawLayer("OVERLAY")
player2HotstreakImage4:Hide()

player2HotstreakImage5 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage5:SetSize(36, 36)
player2HotstreakImage5:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak5.tga")
player2HotstreakImage5:SetDrawLayer("OVERLAY")
player2HotstreakImage5:Hide()

player2HotstreakImage6 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage6:SetSize(36, 36)
player2HotstreakImage6:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak6.tga")
player2HotstreakImage6:SetDrawLayer("OVERLAY")
player2HotstreakImage6:Hide()

player2HotstreakImage7 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage7:SetSize(36, 36)
player2HotstreakImage7:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak7.tga")
player2HotstreakImage7:SetDrawLayer("OVERLAY")
player2HotstreakImage7:Hide()

player2HotstreakImage8 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage8:SetSize(36, 36)
player2HotstreakImage8:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage8:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak8.tga")
player2HotstreakImage8:SetDrawLayer("OVERLAY")
player2HotstreakImage8:Hide()

player2HotstreakImage9 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage9:SetSize(36, 36)
player2HotstreakImage9:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage9:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak9.tga")
player2HotstreakImage9:SetDrawLayer("OVERLAY")
player2HotstreakImage9:Hide()

player2HotstreakImage10 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage10:SetSize(36, 36)
player2HotstreakImage10:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage10:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak10.tga")
player2HotstreakImage10:SetDrawLayer("OVERLAY")
player2HotstreakImage10:Hide()

player2HotstreakImage11 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage11:SetSize(36, 36)
player2HotstreakImage11:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage11:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak11.tga")
player2HotstreakImage11:SetDrawLayer("OVERLAY")
player2HotstreakImage11:Hide()

player2HotstreakImage12 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage12:SetSize(36, 36)
player2HotstreakImage12:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage12:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak12.tga")
player2HotstreakImage12:SetDrawLayer("OVERLAY")
player2HotstreakImage12:Hide()

player2HotstreakImage13 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage13:SetSize(36, 36)
player2HotstreakImage13:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage13:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak13.tga")
player2HotstreakImage13:SetDrawLayer("OVERLAY")
player2HotstreakImage13:Hide()

player2HotstreakImage14 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage14:SetSize(36, 36)
player2HotstreakImage14:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage14:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak14.tga")
player2HotstreakImage14:SetDrawLayer("OVERLAY")
player2HotstreakImage14:Hide()

player2HotstreakImage15 = playerFrame:CreateTexture(nil, "OVERLAY")
player2HotstreakImage15:SetSize(36, 36)
player2HotstreakImage15:SetPoint("CENTER", playerFrame, 171, -228)
player2HotstreakImage15:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak15.tga")
player2HotstreakImage15:SetDrawLayer("OVERLAY")
player2HotstreakImage15:Hide()

local function player2HotStreakCheck()
    if player2Hotstreak == 0 then
        player2HotstreakImage1:Hide()
        player2HotstreakImage2:Hide()
        player2HotstreakImage3:Hide()
        player2HotstreakImage4:Hide()
        player2HotstreakImage5:Hide()
        player2HotstreakImage6:Hide()
        player2HotstreakImage7:Hide()
        player2HotstreakImage8:Hide()
        player2HotstreakImage9:Hide()
        player2HotstreakImage10:Hide()
        player2HotstreakImage11:Hide()
        player2HotstreakImage12:Hide()
        player2HotstreakImage13:Hide()
        player2HotstreakImage14:Hide()
        player2HotstreakImage15:Hide()
    elseif player2Hotstreak == 1 then
        player2HotstreakImage1:Show()
    elseif player2Hotstreak == 2 then
        player2HotstreakImage1:Hide()
        player2HotstreakImage2:Show()
    elseif player2Hotstreak == 3 then
        player2HotstreakImage1:Hide()
        player2HotstreakImage2:Hide()
        player2HotstreakImage3:Show()
    elseif player2Hotstreak == 4 then
        player2HotstreakImage2:Hide()
        player2HotstreakImage3:Hide()
        player2HotstreakImage4:Show()
    elseif player2Hotstreak == 5 then
        player2HotstreakImage3:Hide()
        player2HotstreakImage4:Hide()
        player2HotstreakImage5:Show()
    elseif player2Hotstreak == 6 then
        player2HotstreakImage4:Hide()
        player2HotstreakImage5:Hide()
        player2HotstreakImage6:Show()
    elseif player2Hotstreak == 7 then
        player2HotstreakImage5:Hide()
        player2HotstreakImage6:Hide()
        player2HotstreakImage7:Show()
    elseif player2Hotstreak == 8 then
        player2HotstreakImage6:Hide()
        player2HotstreakImage7:Hide()
        player2HotstreakImage8:Show()
    elseif player2Hotstreak == 9 then
        player2HotstreakImage7:Hide()
        player2HotstreakImage8:Hide()
        player2HotstreakImage9:Show()
    elseif player2Hotstreak == 10 then
        player2HotstreakImage8:Hide()
        player2HotstreakImage9:Hide()
        player2HotstreakImage10:Show()
    elseif player2Hotstreak == 11 then
        player2HotstreakImage9:Hide()
        player2HotstreakImage10:Hide()
        player2HotstreakImage11:Show()
    elseif player2Hotstreak == 12 then
        player2HotstreakImage10:Hide()
        player2HotstreakImage11:Hide()
        player2HotstreakImage12:Show()
    elseif player2Hotstreak == 13 then
        player2HotstreakImage11:Hide()
        player2HotstreakImage12:Hide()
        player2HotstreakImage13:Show()
    elseif player2Hotstreak == 14 then
        player2HotstreakImage12:Hide()
        player2HotstreakImage13:Hide()
        player2HotstreakImage14:Show()
    elseif player2Hotstreak == 15 then
        player2HotstreakImage13:Hide()
        player2HotstreakImage14:Hide()
        player2HotstreakImage15:Show()
    end
end

-- Function to handle Player 2 PP Win Image
function player2PlaceBetsPPWin(message)
    playerFrame.player2PPBetCoins:Hide()
    playerFrame.player2PPWinCoins:Show()
    player2PPBetAmount:SetPoint("CENTER", playerFrame, 123, -6)
end

-- Function to handle Player 2 21+3 Win Image
function player2PlaceBets213Win(message)
    playerFrame.player2213BetCoins:Hide()
    playerFrame.player2213WinCoins:Show()
    player2213BetAmount:SetPoint("CENTER", playerFrame, 231, 46)
end

function player2MixedPairWin(message)

    if playerName == unitName2 then
        player2PPBetAmountValue = tonumber(string.match(player2PPBetEditBox:GetText(), "%d+"))
        if player2PPBetAmountValue then
            player2NewPPAmount = player2PPBetAmountValue * mixedPairPayoutReturn
            player2PPBetAmount:SetText(player2NewPPAmount .. " G")
            player2PPBetAmount:SetTextColor(0, 1, 0)

            player2PPProfitvalue = player2NewPPAmount - player2PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2totalWin = player2totalWin + tonumber(player2PPProfitvalue)
                    bankingInfo.totalWon = player2totalWin
                    player2totalProfit = player2totalProfit + tonumber(player2PPProfitvalue)
                    bankingInfo.totalProfit = player2totalProfit
                    player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2NewPPAmount)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2PPBetAmountValue = tonumber(string.match(player2PPBetAmount:GetText(), "%d+"))
        if player2PPBetAmountValue then
            player2NewPPAmount = player2PPBetAmountValue * mixedPairPayoutReturn
            player2PPBetAmount:SetText(player2NewPPAmount .. " G")
            player2PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBetsPPWin()
    player2PPSideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2NewPPAmount)

end

function player2ColouredPairWin(message)

    if playerName == unitName2 then
        player2PPBetAmountValue = tonumber(string.match(player2PPBetEditBox:GetText(), "%d+"))
        if player2PPBetAmountValue then
            player2NewPPAmount = player2PPBetAmountValue * colouredPairPayoutReturn
            player2PPBetAmount:SetText(player2NewPPAmount .. " G")
            player2PPBetAmount:SetTextColor(0, 1, 0)

            player2PPProfitvalue = player2NewPPAmount - player2PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2totalWin = player2totalWin + tonumber(player2PPProfitvalue)
                    bankingInfo.totalWon = player2totalWin
                    player2totalProfit = player2totalProfit + tonumber(player2PPProfitvalue)
                    bankingInfo.totalProfit = player2totalProfit
                    player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2NewPPAmount)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2PPBetAmountValue = tonumber(string.match(player2PPBetAmount:GetText(), "%d+"))
        if player2PPBetAmountValue then
            player2NewPPAmount = player2PPBetAmountValue * colouredPairPayoutReturn
            player2PPBetAmount:SetText(player2NewPPAmount .. " G")
            player2PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBetsPPWin()
    player2PPSideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2NewPPAmount)

end

function player2PerfectPairWin(message)

    if playerName == unitName2 then
        player2PPBetAmountValue = tonumber(string.match(player2PPBetEditBox:GetText(), "%d+"))
        if player2PPBetAmountValue then
            player2NewPPAmount = player2PPBetAmountValue * perfectPairPayoutReturn
            player2PPBetAmount:SetText(player2NewPPAmount .. " G")
            player2PPBetAmount:SetTextColor(0, 1, 0)

            player2PPProfitvalue = player2NewPPAmount - player2PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2totalWin = player2totalWin + tonumber(player2PPProfitvalue)
                    bankingInfo.totalWon = player2totalWin
                    player2totalProfit = player2totalProfit + tonumber(player2PPProfitvalue)
                    bankingInfo.totalProfit = player2totalProfit
                    player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2NewPPAmount)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2PPBetAmountValue = tonumber(string.match(player2PPBetAmount:GetText(), "%d+"))
        if player2PPBetAmountValue then
            player2NewPPAmount = player2PPBetAmountValue * perfectPairPayoutReturn
            player2PPBetAmount:SetText(player2NewPPAmount .. " G")
            player2PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBetsPPWin()
    player2PPSideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2NewPPAmount)

end

function player2SuitedThreeOfAKindWin(message)

    if playerName == unitName2 then
        player2213BetAmountValue = tonumber(string.match(player2213BetEditBox:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)

            player2213Profitvalue = player2New213Amount - player2213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalWin = player2totalWin + tonumber(player2213Profitvalue)
                bankingInfo.totalWon = player2totalWin
                player2totalProfit = player2totalProfit + tonumber(player2213Profitvalue)
                bankingInfo.totalProfit = player2totalProfit
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2New213Amount)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2213BetAmountValue = tonumber(string.match(player2213BetAmount:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBets213Win()
    player2213SideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2New213Amount)

end

function player2StraightFlushWin(message)

    if playerName == unitName2 then
        player2213BetAmountValue = tonumber(string.match(player2213BetEditBox:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * straightFlushPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)

            player2213Profitvalue = player2New213Amount - player2213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalWin = player2totalWin + tonumber(player2213Profitvalue)
                bankingInfo.totalWon = player2totalWin
                player2totalProfit = player2totalProfit + tonumber(player2213Profitvalue)
                bankingInfo.totalProfit = player2totalProfit
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2New213Amount)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2213BetAmountValue = tonumber(string.match(player2213BetAmount:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * straightFlushPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBets213Win()
    player2213SideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2New213Amount)

end

function player2ThreeOfAKindWin(message)

    if playerName == unitName2 then
        player2213BetAmountValue = tonumber(string.match(player2213BetEditBox:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * threeOfAKindPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)

            player2213Profitvalue = player2New213Amount - player2213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalWin = player2totalWin + tonumber(player2213Profitvalue)
                bankingInfo.totalWon = player2totalWin
                player2totalProfit = player2totalProfit + tonumber(player2213Profitvalue)
                bankingInfo.totalProfit = player2totalProfit
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2New213Amount)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2213BetAmountValue = tonumber(string.match(player2213BetAmount:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * threeOfAKindPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBets213Win()
    player2213SideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2New213Amount)

end

function player2StraightWin(message)

    if playerName == unitName2 then
        player2213BetAmountValue = tonumber(string.match(player2213BetEditBox:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * straightPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)

            player2213Profitvalue = player2New213Amount - player2213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalWin = player2totalWin + tonumber(player2213Profitvalue)
                bankingInfo.totalWon = player2totalWin
                player2totalProfit = player2totalProfit + tonumber(player2213Profitvalue)
                bankingInfo.totalProfit = player2totalProfit
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2New213Amount)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2213BetAmountValue = tonumber(string.match(player2213BetAmount:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * straightPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBets213Win()
    player2213SideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2New213Amount)

end

function player2FlushWin(message)

    if playerName == unitName2 then
        player2213BetAmountValue = tonumber(string.match(player2213BetEditBox:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * flushPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)

            player2213Profitvalue = player2New213Amount - player2213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalWin = player2totalWin + tonumber(player2213Profitvalue)
                bankingInfo.totalWon = player2totalWin
                player2totalProfit = player2totalProfit + tonumber(player2213Profitvalue)
                bankingInfo.totalProfit = player2totalProfit
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2New213Amount)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end

            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        end
    else
        player2213BetAmountValue = tonumber(string.match(player2213BetAmount:GetText(), "%d+"))
        if player2213BetAmountValue then
            player2New213Amount = player2213BetAmountValue * flushPayoutReturn
            player2213BetAmount:SetText(player2New213Amount .. " G")
            player2213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player2PlaceBets213Win()
    player2213SideBetWin = true

    player2SessionWin = player2SessionWin + tonumber(player2New213Amount)

end

function player2Loss()
    player2MainBetValue = tonumber(string.match(player2MainBetAmount:GetText(), "%d+"))
    if player2MainBetValue then
        
        if playerName == unitName2 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalLoss = player2totalLoss + tonumber(player2MainBetValue)
                bankingInfo.totalLost = player2totalLoss
                player2totalProfit = player2totalProfit - tonumber(player2MainBetValue)
                bankingInfo.totalProfit = player2totalProfit
            end
        end

        if player2totalProfit >= 0 then
            historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
        historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")

        local player2PPBetText = player2PPBetAmount:GetText()

        if player2PPBetText and player2PPBetText ~= "" then
            player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
            
            if player2PPBetAmountValue then
                if player2PPSideBetWin == false then

                    player2PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")

                end
            end
        end

        local player2213BetText = player2213BetAmount:GetText()

        if player2213BetText and player2213BetText ~= "" then
            player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

            if player2213BetAmountValue then
                if player2213SideBetWin == false then

                    player2213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")

                end
            end
        end
    end
end

function player2SplitH1Loss()
    player2SplitHand1BetAmountValue = tonumber(string.match(player2SplitH1BetAmount:GetText(), "%d+"))
    if player2SplitHand1BetAmountValue then

        if playerName == unitName2 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalLoss = player2totalLoss + tonumber(player2SplitHand1BetAmountValue)
                bankingInfo.totalLost = player2totalLoss
                player2totalProfit = player2totalProfit - tonumber(player2SplitHand1BetAmountValue)
                bankingInfo.totalProfit = player2totalProfit
            end
        end

        historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
        historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")

        if player2totalProfit >= 0 then
            historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

    end
end

function player2SplitH2Loss()
    player2SplitHand2BetAmountValue = tonumber(string.match(player2SplitH2BetAmount:GetText(), "%d+"))
    if player2SplitHand2BetAmountValue then

        if playerName == unitName2 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalLoss = player2totalLoss + tonumber(player2SplitHand2BetAmountValue)
                bankingInfo.totalLost = player2totalLoss
                player2totalProfit = player2totalProfit - tonumber(player2SplitHand2BetAmountValue)
                bankingInfo.totalProfit = player2totalProfit
            end
        end

        historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
        historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")

        if player2totalProfit >= 0 then
            historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        local player2PPBetText = player2PPBetAmount:GetText()

        if player2PPBetText and player2PPBetText ~= "" then
            player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
            
            if player2PPBetAmountValue then
                if player2PPSideBetWin == false then

                    player2PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player2213BetText = player2213BetAmount:GetText()

        if player2213BetText and player2213BetText ~= "" then
            player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

            if player2213BetAmountValue then
                if player2213SideBetWin == false then

                    player2213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end
end

function player2Push()
    player2MainBetValue = tonumber(string.match(player2MainBetAmount:GetText(), "%d+"))
    if player2MainBetValue then


        if playerName == unitName2 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2MainBetValue)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end
        end

        bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

        local player2PPBetText = player2PPBetAmount:GetText()

        if player2PPBetText and player2PPBetText ~= "" then
            player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
            
            if player2PPBetAmountValue then
                if player2PPSideBetWin == false then

                    player2PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player2213BetText = player2213BetAmount:GetText()

        if player2213BetText and player2213BetText ~= "" then
            player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

            if player2213BetAmountValue then
                if player2213SideBetWin == false then

                    player2213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        player2SessionWin = player2SessionWin + tonumber(player2MainBetValue)

    end
end

function player2SplitH1Push()
    player2SplitHand1BetAmountValue = tonumber(string.match(player2SplitH1BetAmount:GetText(), "%d+"))
    if player2SplitHand1BetAmountValue then

        if playerName == unitName2 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2SplitHand1BetAmountValue)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end
        end

        bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    
        player2SessionWin = player2SessionWin + tonumber(player2SplitHand1BetAmountValue)
    
    end
end

function player2SplitH2Push()
    player2SplitHand2BetAmountValue = tonumber(string.match(player2SplitH2BetAmount:GetText(), "%d+"))
    if player2SplitHand2BetAmountValue then

        if playerName == unitName2 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2SplitHand2BetAmountValue)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end
        end

        bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

        local player2PPBetText = player2PPBetAmount:GetText()

        if player2PPBetText and player2PPBetText ~= "" then
            player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
            
            if player2PPBetAmountValue then
                if player2PPSideBetWin == false then

                    player2PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player2213BetText = player2213BetAmount:GetText()

        if player2213BetText and player2213BetText ~= "" then
            player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

            if player2213BetAmountValue then
                if player2213SideBetWin == false then

                    player2213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    
        player2SessionWin = player2SessionWin + tonumber(player2SplitHand2BetAmountValue)
    
    end
end

function player2BJWin(message)
    player2MainBetAmountValue = tonumber(string.match(player2MainBetAmount:GetText(), "%d+"))
    if player2MainBetAmountValue then
        player2BJWinAmountValue = player2MainBetAmountValue * 2.5
        player2MainBetAmount:SetText(player2BJWinAmountValue .. " G")
    end

    player2BJProfitvalue = player2BJWinAmountValue - player2MainBetAmountValue

    if playerName == unitName2 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player2totalWin = player2totalWin + tonumber(player2BJProfitvalue)
            bankingInfo.totalWon = player2totalWin
            player2totalProfit = player2totalProfit + tonumber(player2BJProfitvalue)
            bankingInfo.totalProfit = player2totalProfit
            player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2BJWinAmountValue)
            bankingInfo.bankrollTable = player2TotalBankrollAmount
        end
    end

    if player2totalProfit >= 0 then
        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
    bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

    local player2PPBetText = player2PPBetAmount:GetText()

    if player2PPBetText and player2PPBetText ~= "" then
        player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
        
        if player2PPBetAmountValue then
            if player2PPSideBetWin == false then

                player2PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName2 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                        bankingInfo.totalLost = player2totalLoss
                        player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                        bankingInfo.totalProfit = player2totalProfit
                    end
                end
        
                historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
        
                if player2totalProfit >= 0 then
                    historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player2213BetText = player2213BetAmount:GetText()

    if player2213BetText and player2213BetText ~= "" then
        player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

        if player2213BetAmountValue then
            if player2213SideBetWin == false then

                player2213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName2 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                        bankingInfo.totalLost = player2totalLoss
                        player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                        bankingInfo.totalProfit = player2totalProfit
                    end
                end
        
                historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
        
                if player2totalProfit >= 0 then
                    historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player2MainBetCoins:Hide()
    playerFrame.player2BJWinCoins:Show()

    player2SessionWin = player2SessionWin + tonumber(player2BJWinAmountValue)

end

function player2SplitH1BJ(message)
    player2SplitHand1BetAmountValue = tonumber(string.match(player2SplitH1BetAmount:GetText(), "%d+"))
    if player2SplitHand1BetAmountValue then
        player2SplitHand1BJWinAmountValue = player2SplitHand1BetAmountValue * 2.5
        player2SplitH1BetAmount:SetText(player2SplitHand1BJWinAmountValue .. " G")
    end

    player2SplitHand1BJProfitValue = player2SplitHand1BJWinAmountValue - player2SplitHand1BetAmountValue

    if playerName == unitName2 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player2totalWin = player2totalWin + tonumber(player2SplitHand1BJProfitValue)
            bankingInfo.totalWon = player2totalWin
            player2totalProfit = player2totalProfit + tonumber(player2SplitHand1BJProfitValue)
            bankingInfo.totalProfit = player2totalProfit
            player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2SplitHand1BJWinAmountValue)
            bankingInfo.bankrollTable = player2TotalBankrollAmount
        end
    end

    if player2totalProfit >= 0 then
        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
    bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

    playerFrame.player2SplitHand1Coins:Hide()
    playerFrame.player2SplitHand1BJWinCoins:Show()

    player2SessionWin = player2SessionWin + tonumber(player2SplitHand1BJWinAmountValue)

end

function player2SplitH2BJ(message)
    player2SplitHand2BetAmountValue = tonumber(string.match(player2SplitH2BetAmount:GetText(), "%d+"))
    if player2SplitHand2BetAmountValue then
        player2SplitHand2BJWinAmountValue = player2SplitHand2BetAmountValue * 2.5
        player2SplitH2BetAmount:SetText(player2SplitHand2BJWinAmountValue .. " G")
    end

    player2SplitHand2BJProfitValue = player2SplitHand2BJWinAmountValue - player2SplitHand2BetAmountValue

    if playerName == unitName2 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player2totalWin = player2totalWin + tonumber(player2SplitHand2BJProfitValue)
            bankingInfo.totalWon = player2totalWin
            player2totalProfit = player2totalProfit + tonumber(player2SplitHand2BJProfitValue)
            bankingInfo.totalProfit = player2totalProfit
            player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2SplitHand2BJWinAmountValue)
            bankingInfo.bankrollTable = player2TotalBankrollAmount
        end
    end

    if player2totalProfit >= 0 then
        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
    bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

    local player2PPBetText = player2PPBetAmount:GetText()

    if player2PPBetText and player2PPBetText ~= "" then
        player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
        
        if player2PPBetAmountValue then
            if player2PPSideBetWin == false then

                player2PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName2 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                        bankingInfo.totalLost = player2totalLoss
                        player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                        bankingInfo.totalProfit = player2totalProfit
                    end
                end
        
                historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
        
                if player2totalProfit >= 0 then
                    historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player2213BetText = player2213BetAmount:GetText()

    if player2213BetText and player2213BetText ~= "" then
        player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

        if player2213BetAmountValue then
            if player2213SideBetWin == false then

                player2213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName2 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                        bankingInfo.totalLost = player2totalLoss
                        player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                        bankingInfo.totalProfit = player2totalProfit
                    end
                end
        
                historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
        
                if player2totalProfit >= 0 then
                    historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player2SplitHand2Coins:Hide()
    playerFrame.player2SplitHand2BJWinCoins:Show()

    player2SessionWin = player2SessionWin + tonumber(player2SplitHand2BJWinAmountValue)

end

function player2Win(message)
    player2MainBetAmountValue = tonumber(string.match(player2MainBetAmount:GetText(), "%d+"))
    if player2MainBetAmountValue then
        player2NormalWinAmountValue = player2MainBetAmountValue * 2
        player2MainBetAmount:SetText(player2NormalWinAmountValue .. " G")

        if playerName == unitName2 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player2totalWin = player2totalWin + tonumber(player2MainBetAmountValue)
                bankingInfo.totalWon = player2totalWin
                player2totalProfit = player2totalProfit + tonumber(player2MainBetAmountValue)
                bankingInfo.totalProfit = player2totalProfit
                player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2NormalWinAmountValue)
                bankingInfo.bankrollTable = player2TotalBankrollAmount
            end
        end
    
        if player2totalProfit >= 0 then
            historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end
    
        historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
        historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
        bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

        local player2PPBetText = player2PPBetAmount:GetText()

        if player2PPBetText and player2PPBetText ~= "" then
            player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
            
            if player2PPBetAmountValue then
                if player2PPSideBetWin == false then

                    player2PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player2213BetText = player2213BetAmount:GetText()

        if player2213BetText and player2213BetText ~= "" then
            player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

            if player2213BetAmountValue then
                if player2213SideBetWin == false then

                    player2213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName2 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                            bankingInfo.totalLost = player2totalLoss
                            player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                            bankingInfo.totalProfit = player2totalProfit
                        end
                    end
            
                    historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            
                    if player2totalProfit >= 0 then
                        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end

    playerFrame.player2MainBetCoins:Hide()
    playerFrame.player2NormalWinCoins:Show()

    player2SessionWin = player2SessionWin + tonumber(player2NormalWinAmountValue)

end

function player2SplitH1Win(message)
    player2SplitHand1BetAmountValue = tonumber(string.match(player2SplitH1BetAmount:GetText(), "%d+"))
    if player2SplitHand1BetAmountValue then
        player2SplitHand1NormalWinAmountValue = player2SplitHand1BetAmountValue * 2
        player2SplitH1BetAmount:SetText(player2SplitHand1NormalWinAmountValue .. " G")
    end

    if playerName == unitName2 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player2totalWin = player2totalWin + tonumber(player2SplitHand1BetAmountValue)
            bankingInfo.totalWon = player2totalWin
            player2totalProfit = player2totalProfit + tonumber(player2SplitHand1BetAmountValue)
            bankingInfo.totalProfit = player2totalProfit
            player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2SplitHand1NormalWinAmountValue)
            bankingInfo.bankrollTable = player2TotalBankrollAmount
        end
    end

    if player2totalProfit >= 0 then
        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
    bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

    playerFrame.player2SplitHand1Coins:Hide()
    playerFrame.player2SplitHand1NormalWinCoins:Show()

    player2SessionWin = player2SessionWin + tonumber(player2SplitHand1NormalWinAmountValue)

end

function player2SplitH2Win(message)
    player2SplitHand2BetAmountValue = tonumber(string.match(player2SplitH2BetAmount:GetText(), "%d+"))
    if player2SplitHand2BetAmountValue then
        player2SplitHand2NormalWinAmountValue = player2SplitHand2BetAmountValue * 2
        player2SplitH2BetAmount:SetText(player2SplitHand2NormalWinAmountValue .. " G")
    end

    if playerName == unitName2 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player2totalWin = player2totalWin + tonumber(player2SplitHand2BetAmountValue)
            bankingInfo.totalWon = player2totalWin
            player2totalProfit = player2totalProfit + tonumber(player2SplitHand2BetAmountValue)
            bankingInfo.totalProfit = player2totalProfit
            player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2SplitHand2NormalWinAmountValue)
            bankingInfo.bankrollTable = player2TotalBankrollAmount
        end
    end

    if player2totalProfit >= 0 then
        historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
    historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
    bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

    local player2PPBetText = player2PPBetAmount:GetText()

    if player2PPBetText and player2PPBetText ~= "" then
        player2PPBetAmountValue = tonumber(string.match(player2PPBetText, "%d+"))
        
        if player2PPBetAmountValue then
            if player2PPSideBetWin == false then

                player2PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName2 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player2totalLoss = player2totalLoss + tonumber(player2PPBetAmountValue)
                        bankingInfo.totalLost = player2totalLoss
                        player2totalProfit = player2totalProfit - tonumber(player2PPBetAmountValue)
                        bankingInfo.totalProfit = player2totalProfit
                    end
                end
        
                historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
        
                if player2totalProfit >= 0 then
                    historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player2213BetText = player2213BetAmount:GetText()

    if player2213BetText and player2213BetText ~= "" then
        player2213BetAmountValue = tonumber(string.match(player2213BetText, "%d+"))

        if player2213BetAmountValue then
            if player2213SideBetWin == false then

                player2213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName2 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player2totalLoss = player2totalLoss + tonumber(player2213BetAmountValue)
                        bankingInfo.totalLost = player2totalLoss
                        player2totalProfit = player2totalProfit - tonumber(player2213BetAmountValue)
                        bankingInfo.totalProfit = player2totalProfit
                    end
                end
        
                historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
                historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
        
                if player2totalProfit >= 0 then
                    historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player2SplitHand2Coins:Hide()
    playerFrame.player2SplitHand2NormalWinCoins:Show()

    player2SessionWin = player2SessionWin + tonumber(player2SplitHand2NormalWinAmountValue)

end

function player2InsuranceWin(message)

    local player2InsuranceBetText = playerFrame.player2InsuranceBetAmount:GetText()

    if player2InsuranceBetText and player2InsuranceBetText ~= "" then
        player2InsuranceBetAmountValue = tonumber(string.match(player2InsuranceBetText, "%d+"))

        if player2InsuranceBetAmountValue then
            player2InsuranceWinAmountValue = player2InsuranceBetAmountValue * 3

            player2InsuranceProfitValue = player2InsuranceWinAmountValue - player2InsuranceBetAmountValue


            if playerName == unitName2 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2totalWin = player2totalWin + tonumber(player2InsuranceProfitValue)
                    bankingInfo.totalWon = player2totalWin
                    player2totalProfit = player2totalProfit + tonumber(player2InsuranceProfitValue)
                    bankingInfo.totalProfit = player2totalProfit
                    player2TotalBankrollAmount = player2TotalBankrollAmount + tonumber(player2InsuranceWinAmountValue)
                    bankingInfo.bankrollTable = player2TotalBankrollAmount
                end
            end
        
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
        
            historyFrame.player2totalWonAmount:SetText(player2totalWin .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")
            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")

            player2SessionWin = player2SessionWin + tonumber(player2InsuranceWinAmountValue)

        end
    end
end

function player2InsuranceLoss(message)

    local player2InsuranceBetText = playerFrame.player2InsuranceBetAmount:GetText()

    if player2InsuranceBetText and player2InsuranceBetText ~= "" then
        player2InsuranceBetAmountValue = tonumber(string.match(player2InsuranceBetText, "%d+"))

        if player2InsuranceBetAmountValue then

            if playerName == unitName2 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player2totalLoss = player2totalLoss + tonumber(player2InsuranceBetAmountValue)
                    bankingInfo.totalLost = player2totalLoss
                    player2totalProfit = player2totalProfit - tonumber(player2InsuranceBetAmountValue)
                    bankingInfo.totalProfit = player2totalProfit
                end
            end
    
            if player2totalProfit >= 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
    
            historyFrame.player2totalLostAmount:SetText(player2totalLoss .. " G")
            historyFrame.player2ProfitAmount:SetText(player2totalProfit .. " G")

        end
    end
end

local function player2SessionWinAnnouncement()
    if playerName == unitName2 then
        if player2SessionWinCalled == false then
            if player2SessionWin >= 2 then
                local chatFrame = SELECTED_DOCK_FRAME
                ChatFrame_OpenChat("/me", chatFrame)
                
                local editBox = _G[chatFrame:GetName().."EditBox"]
                editBox:SetText("")
                editBox:Insert("/me has won " .. player2SessionWin .. "g from a hand of Blackjack.")
                
                ChatEdit_SendText(editBox)
                ChatEdit_DeactivateChat(editBox)

                UpdateWinningsDisplay(playerFrame.player2WinningsUpdate, player2SessionWin)
                player2resetRaidChannel()
                
            else
                print("")
            end

            player2SessionWinCalled = true
        end
    end
end





















-- >>> PLAYER 3 <<<
-- >>> PLAYER 3 <<<
-- >>> PLAYER 3 <<<

playerFrame.player3CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 4, 180)
playerFrame.player3CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 28, "OUTLINE") -- Adjust the font and size as needed
playerFrame.player3CardTotalText:SetText("")

playerFrame.player3SplitHand1CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3SplitHand1CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", 51, 188)
playerFrame.player3SplitHand1CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player3SplitHand1CardTotalText:SetText("")

playerFrame.player3SplitHand2CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3SplitHand2CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", -42, 188)
playerFrame.player3SplitHand2CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player3SplitHand2CardTotalText:SetText("")

-- Buttons for Player 3
-- Hit
playerFrame.player3HitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3HitButton:SetPoint("BOTTOM", playerFrame, -33, 80)
playerFrame.player3HitButton:SetSize(65, 30)
playerFrame.player3HitButton:SetText("Hit")
playerFrame.player3HitButton:Disable()
playerFrame.player3HitButton:Hide()
-- Stand
playerFrame.player3StandButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3StandButton:SetPoint("BOTTOM", playerFrame, 33, 80)
playerFrame.player3StandButton:SetSize(65, 30)
playerFrame.player3StandButton:SetText("Stand")
playerFrame.player3StandButton:Disable()
playerFrame.player3StandButton:Hide()
-- Double
playerFrame.player3DoubleButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3DoubleButton:SetPoint("BOTTOM", playerFrame, -33, 50)
playerFrame.player3DoubleButton:SetSize(65, 30)
playerFrame.player3DoubleButton:SetText("Double")
playerFrame.player3DoubleButton:Disable()
playerFrame.player3DoubleButton:Hide()
-- Split
playerFrame.player3SplitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3SplitButton:SetPoint("BOTTOM", playerFrame, 33, 50)
playerFrame.player3SplitButton:SetSize(65, 30)
playerFrame.player3SplitButton:SetText("Split")
playerFrame.player3SplitButton:Disable()
playerFrame.player3SplitButton:Hide()
-- Insurance Yes
playerFrame.player3InsuranceYesButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3InsuranceYesButton:SetPoint("BOTTOM", playerFrame, -65, 20)
playerFrame.player3InsuranceYesButton:SetSize(55, 30)
playerFrame.player3InsuranceYesButton:SetText("Yes")
playerFrame.player3InsuranceYesButton:Disable()
playerFrame.player3InsuranceYesButton:Hide()
-- Insurance No
playerFrame.player3InsuranceNoButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3InsuranceNoButton:SetPoint("BOTTOM", playerFrame, 63, 20)
playerFrame.player3InsuranceNoButton:SetSize(55, 30)
playerFrame.player3InsuranceNoButton:SetText("No")
playerFrame.player3InsuranceNoButton:Disable()
playerFrame.player3InsuranceNoButton:Hide()
-- Deal Now
playerFrame.player3DealNowButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3DealNowButton:SetPoint("BOTTOM", playerFrame, 0, 20)
playerFrame.player3DealNowButton:SetSize(85, 30)
playerFrame.player3DealNowButton:SetText("Deal Now")
playerFrame.player3DealNowButton:Disable()
playerFrame.player3DealNowButton:Hide()
-- Hit (Split H1)
playerFrame.player3HitButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3HitButtonSplitH1:SetPoint("BOTTOM", playerFrame, 33, 80)
playerFrame.player3HitButtonSplitH1:SetSize(65, 30)
playerFrame.player3HitButtonSplitH1:SetText("Hit")
playerFrame.player3HitButtonSplitH1:Disable()
playerFrame.player3HitButtonSplitH1:Hide()
-- Stand (Split H1)
playerFrame.player3StandButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3StandButtonSplitH1:SetPoint("BOTTOM", playerFrame, 33, 50)
playerFrame.player3StandButtonSplitH1:SetSize(65, 30)
playerFrame.player3StandButtonSplitH1:SetText("Stand")
playerFrame.player3StandButtonSplitH1:Disable()
playerFrame.player3StandButtonSplitH1:Hide()
-- Double (Split H1)
playerFrame.player3DoubleButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3DoubleButtonSplitH1:SetPoint("BOTTOM", playerFrame, 33, 20)
playerFrame.player3DoubleButtonSplitH1:SetSize(65, 30)
playerFrame.player3DoubleButtonSplitH1:SetText("Double")
playerFrame.player3DoubleButtonSplitH1:Disable()
playerFrame.player3DoubleButtonSplitH1:Hide()
-- Hit (Split H2)
playerFrame.player3HitButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3HitButtonSplitH2:SetPoint("BOTTOM", playerFrame, -33, 80)
playerFrame.player3HitButtonSplitH2:SetSize(65, 30)
playerFrame.player3HitButtonSplitH2:SetText("Hit")
playerFrame.player3HitButtonSplitH2:Disable()
playerFrame.player3HitButtonSplitH2:Hide()
-- Stand (Split H2)
playerFrame.player3StandButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3StandButtonSplitH2:SetPoint("BOTTOM", playerFrame, -33, 50)
playerFrame.player3StandButtonSplitH2:SetSize(65, 30)
playerFrame.player3StandButtonSplitH2:SetText("Stand")
playerFrame.player3StandButtonSplitH2:Disable()
playerFrame.player3StandButtonSplitH2:Hide()
-- Double (Split H2)
playerFrame.player3DoubleButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player3DoubleButtonSplitH2:SetPoint("BOTTOM", playerFrame, -33, 20)
playerFrame.player3DoubleButtonSplitH2:SetSize(65, 30)
playerFrame.player3DoubleButtonSplitH2:SetText("Double")
playerFrame.player3DoubleButtonSplitH2:Disable()
playerFrame.player3DoubleButtonSplitH2:Hide()
-- Main Bet Confirm
player3ConfirmMainBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player3ConfirmMainBetButton:SetPoint("BOTTOM", playerFrame, 33, 140)
player3ConfirmMainBetButton:SetSize(65, 30)
player3ConfirmMainBetButton:SetText("Bet")
player3ConfirmMainBetButton:Hide()
-- Perfect Pairs Confirm
player3ConfirmPPBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player3ConfirmPPBetButton:SetPoint("BOTTOM", playerFrame, -56, 232)
player3ConfirmPPBetButton:SetSize(43, 25)
player3ConfirmPPBetButton:SetText("Bet")
player3ConfirmPPBetButton:Hide()
-- 21+3 Confirm
player3Confirm213BetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player3Confirm213BetButton:SetPoint("BOTTOM", playerFrame, 64, 232)
player3Confirm213BetButton:SetSize(43, 25)
player3Confirm213BetButton:SetText("Bet")
player3Confirm213BetButton:Hide()

-- Wagers for Player 3
-- Main Bet
player3MainBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player3MainBetEditBox:SetSize(55, 30)
player3MainBetEditBox:SetPoint("BOTTOM", playerFrame, -30, 140)
player3MainBetEditBox:SetAutoFocus(false)
player3MainBetEditBox:SetNumeric(true)
player3MainBetEditBox:Hide()
-- Split Hand 1
player3SplitH1EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player3SplitH1EditBox:SetSize(55, 30)
player3SplitH1EditBox:SetPoint("BOTTOM", playerFrame, 35, 140)
player3SplitH1EditBox:SetAutoFocus(false)
player3SplitH1EditBox:SetNumeric(true)
player3SplitH1EditBox:ClearFocus()
player3SplitH1EditBox:Disable()
player3SplitH1EditBox:Hide()
-- Split Hand 2
player3SplitH2EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player3SplitH2EditBox:SetSize(55, 30)
player3SplitH2EditBox:SetPoint("BOTTOM", playerFrame, -30, 140)
player3SplitH2EditBox:SetAutoFocus(false)
player3SplitH2EditBox:SetNumeric(true)
player3SplitH2EditBox:ClearFocus()
player3SplitH2EditBox:Disable()
player3SplitH2EditBox:Hide()
-- Perfect Pairs
player3PPBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player3PPBetEditBox:SetSize(35, 30)
player3PPBetEditBox:SetPoint("BOTTOM", playerFrame, -54, 252)
player3PPBetEditBox:SetAutoFocus(false)
player3PPBetEditBox:SetNumeric(true)
player3PPBetEditBox:Hide()
-- 21+3
player3213BetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player3213BetEditBox:SetSize(35, 30)
player3213BetEditBox:SetPoint("BOTTOM", playerFrame, 66, 252)
player3213BetEditBox:SetAutoFocus(false)
player3213BetEditBox:SetNumeric(true)
player3213BetEditBox:Hide()

-- Labels for Player 3
-- Main Bet
playerFrame.player3MainBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3MainBetTitle:SetPoint("BOTTOM", playerFrame, -31, 167)
playerFrame.player3MainBetTitle:SetJustifyH("CENTER")
playerFrame.player3MainBetTitle:SetText("Main Bet")
playerFrame.player3MainBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player3MainBetTitle:Hide()
-- Split Hand 1
playerFrame.player3SplitH1Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3SplitH1Title:SetPoint("BOTTOM", playerFrame, 34, 167)
playerFrame.player3SplitH1Title:SetJustifyH("CENTER")
playerFrame.player3SplitH1Title:SetText("Hand 1")
playerFrame.player3SplitH1Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player3SplitH1Title:Hide()
-- Split Hand 2
playerFrame.player3SplitH2Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3SplitH2Title:SetPoint("BOTTOM", playerFrame, -31, 167)
playerFrame.player3SplitH2Title:SetJustifyH("CENTER")
playerFrame.player3SplitH2Title:SetText("Hand 2")
playerFrame.player3SplitH2Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player3SplitH2Title:Hide()
-- Main Bet Amount
player3MainBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3MainBetAmount:SetPoint("CENTER", playerFrame, 6, -59)
player3MainBetAmount:SetJustifyH("CENTER")
player3MainBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 1 Amount
player3SplitH1BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3SplitH1BetAmount:SetPoint("CENTER", playerFrame, 24, -53)
player3SplitH1BetAmount:SetJustifyH("CENTER")
player3SplitH1BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 2 Amount
player3SplitH2BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3SplitH2BetAmount:SetPoint("CENTER", playerFrame, -11, -53)
player3SplitH2BetAmount:SetJustifyH("CENTER")
player3SplitH2BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Perfect Pairs
playerFrame.player3PPBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3PPBetTitle:SetPoint("BOTTOM", playerFrame, -90, 250)
playerFrame.player3PPBetTitle:SetJustifyH("CENTER")
playerFrame.player3PPBetTitle:SetText("PP")
playerFrame.player3PPBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player3PPBetTitle:Hide()
-- Perfect Pairs Amount
player3PPBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3PPBetAmount:SetPoint("CENTER", playerFrame, -51, -35)
player3PPBetAmount:SetJustifyH("CENTER")
player3PPBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- 21+3
playerFrame.player3213BetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3213BetTitle:SetPoint("BOTTOM", playerFrame, 109, 250)
playerFrame.player3213BetTitle:SetJustifyH("CENTER")
playerFrame.player3213BetTitle:SetText("21+3")
playerFrame.player3213BetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player3213BetTitle:Hide()
-- 21+3 Amount
player3213BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player3213BetAmount:SetPoint("CENTER", playerFrame, 67, -36)
player3213BetAmount:SetJustifyH("CENTER")
player3213BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Insurance Amount
playerFrame.player3InsuranceBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3InsuranceBetAmount:SetPoint("CENTER", playerFrame, 109, -305)
playerFrame.player3InsuranceBetAmount:SetJustifyH("CENTER")
playerFrame.player3InsuranceBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE")
-- Player Name
playerFrame.player3Name = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3Name:SetPoint("BOTTOM", playerFrame, 0, 116)
playerFrame.player3Name:SetText("Seat Empty")
playerFrame.player3Name:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
-- Insurance
playerFrame.player3InsuranceTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3InsuranceTitle:SetPoint("BOTTOM", playerFrame, 0, 34)
playerFrame.player3InsuranceTitle:SetText("Insurance")
playerFrame.player3InsuranceTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
playerFrame.player3InsuranceTitle:Hide()
-- Insurance (if available)
playerFrame.player3InsuranceSubtitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3InsuranceSubtitle:SetPoint("BOTTOM", playerFrame, 0, 24)
playerFrame.player3InsuranceSubtitle:SetText("(if available)")
playerFrame.player3InsuranceSubtitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player3InsuranceSubtitle:Hide()
-- Session Win Update
playerFrame.player3WinningsUpdate = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player3WinningsUpdate:SetPoint("BOTTOMLEFT", playerFrame, 270, 30) 
playerFrame.player3WinningsUpdate:SetText("")
playerFrame.player3WinningsUpdate:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
playerFrame.player3WinningsUpdate:SetTextColor(0.118, 0.839, 0.412)

-- Images for Player 3
-- Turn Arrow
playerFrame.player3TurnArrow = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3TurnArrow:SetSize(128, 128)
playerFrame.player3TurnArrow:SetPoint("CENTER", playerFrame, 109, -213)
playerFrame.player3TurnArrow:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\TurnArrow.tga")
playerFrame.player3TurnArrow:SetBlendMode("BLEND")
playerFrame.player3TurnArrow:SetDrawLayer("OVERLAY")
playerFrame.player3TurnArrow:Hide()
-- Main Bet
playerFrame.player3MainBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3MainBetCoins:SetSize(128, 128)
playerFrame.player3MainBetCoins:SetPoint("CENTER", playerFrame, 23, -90)
playerFrame.player3MainBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player3MainBetCoins:SetBlendMode("BLEND")
playerFrame.player3MainBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player3MainBetCoins:Hide()
-- Win
playerFrame.player3NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3NormalWinCoins:SetSize(128, 128)
playerFrame.player3NormalWinCoins:SetPoint("CENTER", playerFrame, 23, -90)
playerFrame.player3NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player3NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player3NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3NormalWinCoins:Hide()
-- Split Hand 2 Bet
playerFrame.player3SplitHand2Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand2Coins:SetSize(128, 128)
playerFrame.player3SplitHand2Coins:SetPoint("CENTER", playerFrame, 5, -85)
playerFrame.player3SplitHand2Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player3SplitHand2Coins:SetBlendMode("BLEND")
playerFrame.player3SplitHand2Coins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand2Coins:Hide()
-- Split Double Hand 2 Bet
playerFrame.player3SplitHand2DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand2DoubleCoins:SetSize(128, 128)
playerFrame.player3SplitHand2DoubleCoins:SetPoint("CENTER", playerFrame, 2, -94)
playerFrame.player3SplitHand2DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player3SplitHand2DoubleCoins:SetBlendMode("BLEND")
playerFrame.player3SplitHand2DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand2DoubleCoins:Hide()
-- Split Win Hand 2
playerFrame.player3SplitHand2NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand2NormalWinCoins:SetSize(128, 128)
playerFrame.player3SplitHand2NormalWinCoins:SetPoint("CENTER", playerFrame, 2, -94)
playerFrame.player3SplitHand2NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player3SplitHand2NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player3SplitHand2NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand2NormalWinCoins:Hide()
-- Split Hand 1 Bet
playerFrame.player3SplitHand1Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand1Coins:SetSize(128, 128)
playerFrame.player3SplitHand1Coins:SetPoint("CENTER", playerFrame, 40, -85)
playerFrame.player3SplitHand1Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player3SplitHand1Coins:SetBlendMode("BLEND")
playerFrame.player3SplitHand1Coins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand1Coins:Hide()
-- Split Double Hand 1 Bet
playerFrame.player3SplitHand1DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand1DoubleCoins:SetSize(128, 128)
playerFrame.player3SplitHand1DoubleCoins:SetPoint("CENTER", playerFrame, 45, -94)
playerFrame.player3SplitHand1DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player3SplitHand1DoubleCoins:SetBlendMode("BLEND")
playerFrame.player3SplitHand1DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand1DoubleCoins:Hide()
-- Split Win Hand 1
playerFrame.player3SplitHand1NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand1NormalWinCoins:SetSize(128, 128)
playerFrame.player3SplitHand1NormalWinCoins:SetPoint("CENTER", playerFrame, 45, -94)
playerFrame.player3SplitHand1NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player3SplitHand1NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player3SplitHand1NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand1NormalWinCoins:Hide()
-- Blackjack Win
playerFrame.player3BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3BJWinCoins:SetSize(128, 128)
playerFrame.player3BJWinCoins:SetPoint("CENTER", playerFrame, 23, -90)
playerFrame.player3BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player3BJWinCoins:SetBlendMode("BLEND")
playerFrame.player3BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3BJWinCoins:Hide()
-- Split BJ Win Hand 2
playerFrame.player3SplitHand2BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand2BJWinCoins:SetSize(128, 128)
playerFrame.player3SplitHand2BJWinCoins:SetPoint("CENTER", playerFrame, 2, -94)
playerFrame.player3SplitHand2BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player3SplitHand2BJWinCoins:SetBlendMode("BLEND")
playerFrame.player3SplitHand2BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand2BJWinCoins:Hide()
-- Split BJ Win Hand 1
playerFrame.player3SplitHand1BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3SplitHand1BJWinCoins:SetSize(128, 128)
playerFrame.player3SplitHand1BJWinCoins:SetPoint("CENTER", playerFrame, 45, -94)
playerFrame.player3SplitHand1BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player3SplitHand1BJWinCoins:SetBlendMode("BLEND")
playerFrame.player3SplitHand1BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3SplitHand1BJWinCoins:Hide()
-- Double Bet
playerFrame.player3DoubleBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3DoubleBetCoins:SetSize(128, 128)
playerFrame.player3DoubleBetCoins:SetPoint("CENTER", playerFrame, 23, -90)
playerFrame.player3DoubleBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player3DoubleBetCoins:SetBlendMode("BLEND")
playerFrame.player3DoubleBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player3DoubleBetCoins:Hide()
-- PP Bet
playerFrame.player3PPBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3PPBetCoins:SetSize(128, 128)
playerFrame.player3PPBetCoins:SetPoint("CENTER", playerFrame, -47, -55)
playerFrame.player3PPBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player3PPBetCoins:SetBlendMode("BLEND")
playerFrame.player3PPBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player3PPBetCoins:Hide()
-- 21+3 Bet
playerFrame.player3213BetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3213BetCoins:SetSize(128, 128)
playerFrame.player3213BetCoins:SetPoint("CENTER", playerFrame, 72, -56)
playerFrame.player3213BetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player3213BetCoins:SetBlendMode("BLEND")
playerFrame.player3213BetCoins:SetDrawLayer("OVERLAY")
playerFrame.player3213BetCoins:Hide()
-- PP Win
playerFrame.player3PPWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3PPWinCoins:SetSize(128, 128)
playerFrame.player3PPWinCoins:SetPoint("CENTER", playerFrame, -35, -51)
playerFrame.player3PPWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player3PPWinCoins:SetBlendMode("BLEND")
playerFrame.player3PPWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3PPWinCoins:Hide()
-- 21+3 Win
playerFrame.player3213WinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player3213WinCoins:SetSize(128, 128)
playerFrame.player3213WinCoins:SetPoint("CENTER", playerFrame, 83, -51)
playerFrame.player3213WinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player3213WinCoins:SetBlendMode("BLEND")
playerFrame.player3213WinCoins:SetDrawLayer("OVERLAY")
playerFrame.player3213WinCoins:Hide()
-- Insurance YES for Player 3
player3InsuranceYesIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player3InsuranceYesIcon:SetSize(24, 24)
player3InsuranceYesIcon:SetPoint("CENTER", playerFrame, 105, -324)
player3InsuranceYesIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceYes.tga")
player3InsuranceYesIcon:SetDrawLayer("OVERLAY")
player3InsuranceYesIcon:Hide()
-- Insurance NO for Player 3
player3InsuranceNoIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player3InsuranceNoIcon:SetSize(24, 24)
player3InsuranceNoIcon:SetPoint("CENTER", playerFrame, 105, -324)
player3InsuranceNoIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceNo.tga")
player3InsuranceNoIcon:SetDrawLayer("OVERLAY")
player3InsuranceNoIcon:Hide()

-- BJ Win Coins
local function player3PlaceCoinsBJWin(message)
    playerFrame.player3MainBetCoins:Hide()
    playerFrame.player3BJWinCoins:Show()
end

-- Regular Win Coins
local function player3PlaceCoinsRegularWin(message)
    playerFrame.player3MainBetCoins:Hide()
    playerFrame.player3DoubleBetCoins:Show()
end

-- Main Bet Coins
local function player3PlaceCoinsMainBet(message)
    playerFrame.player3MainBetCoins:Show()
end

-- Double Bet Coins
local function player3PlaceCoinsDoubleBet(message)
    playerFrame.player3MainBetCoins:Hide()
    playerFrame.player3DoubleBetCoins:Show()
end

-- Function to handle Player 3 Main Bet Text
local function player3PlaceTextMainBet(message)
    local player3HistoryMainBet = string.match(message, "(%d+)G")

        if player3HistoryMainBet then
            player3MainBetAmount:SetText(player3HistoryMainBet .. " G")
            player3MainBetAmount:Show()

            if playerName == unitName3 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName3]
                    player3totalBetAmount = player3totalBetAmount + tonumber(player3HistoryMainBet)
                    bankingInfo.totalWagered = player3totalBetAmount
                end
            end

            historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")

        else
    end
end

-- Player 3 Split Hand Bet Text
function player3SplitHand1BetText(Amount)
    player3MainBetAmount:Hide()
    player3MainBetAmount:SetText("")
    player3SplitH1BetAmount:SetText(Amount .. " G")
    player3SplitH1BetAmount:Show()
    player3SplitH2BetAmount:SetText(Amount .. " G")
    player3SplitH2BetAmount:Show()
end

-- Player 3 Split Bet Image
function player3PlaceSplitBet(message)
    playerFrame.player3MainBetCoins:Hide()
    playerFrame.player3SplitHand1Coins:Show()
    playerFrame.player3SplitHand2Coins:Show()
end

-- Player 3 Place Initial Card Images
function player3PlaceSplitCards(message)

    -- Players: 3
    if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[3]:Hide()
        player3cardName1 = dealtCards[1]
        player3cardName2 = dealtCards[3]
        turn = 8 -- Player 3: 2nd Card (Split H1)

    -- Players: 1, 3
    elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[5]
        turn = 30 -- Player 3: 2nd Card (Split H1)
    -- Players: 2, 3
    elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[5]
        turn = 30 -- Player 3: 2nd Card (Split H1)
    -- Players: 3, 4
    elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player3cardName1 = dealtCards[1]
        player3cardName2 = dealtCards[4]
        turn = 10 -- Player 3: 2nd Card (Split H1)
    -- Players: 3, 5
    elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player3cardName1 = dealtCards[1]
        player3cardName2 = dealtCards[4]
        turn = 10 -- Player 3: 2nd Card (Split H1)

    -- Players: 1, 2, 3
    elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player3cardName1 = dealtCards[3]
        player3cardName2 = dealtCards[7]
        turn = 52 -- Player 3: 2nd Card (Split H1)
    -- Players: 1, 3, 4
    elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[6]
        turn = 32 -- Player 3: 2nd Card (Split H1)
    -- Players: 1, 3, 5
    elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[6]
        turn = 32 -- Player 3: 2nd Card (Split H1)
    -- Players: 2, 3, 4
    elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[6]
        turn = 32 -- Player 3: 2nd Card (Split H1)
    -- Players: 2, 3, 5
    elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[6]
        turn = 32 -- Player 3: 2nd Card (Split H1)
    -- Players: 3, 4, 5
    elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
        drawnCards[1]:Hide()
        drawnCards[5]:Hide()
        player3cardName1 = dealtCards[1]
        player3cardName2 = dealtCards[5]
        turn = 12 -- Player 3: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4
    elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[3]:Hide()
        drawnCards[8]:Hide()
        player3cardName1 = dealtCards[3]
        player3cardName2 = dealtCards[8]
        turn = 54 -- Player 3: 2nd Card (Split H1)
    -- Players: 1, 2, 3, 5
    elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[8]:Hide()
        player3cardName1 = dealtCards[3]
        player3cardName2 = dealtCards[8]
        turn = 54 -- Player 3: 2nd Card (Split H1)
    -- Players: 1, 3, 4, 5
    elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[7]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[7]
        turn = 34 -- Player 3: 2nd Card (Split H1)
    -- Players: 2, 3, 4, 5
    elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[7]:Hide()
        player3cardName1 = dealtCards[2]
        player3cardName2 = dealtCards[7]
        turn = 34 -- Player 3: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4, 5
    elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[9]:Hide()
        player3cardName1 = dealtCards[3]
        player3cardName2 = dealtCards[9]
        turn = 56 -- Player 3: 2nd Card (Split H1)

    end

    player3cardImageFile1 = nil
    player3cardImageFile2 = nil

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player3cardName1 then
            player3cardImageFile1 = filename
            break
        end
    end

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player3cardName2 then
            player3cardImageFile2 = filename
            break
        end
    end

    player3NewCardImage1 = CreateFrame("Frame", nil, playerFrame)
    player3NewCardImage1:SetSize(32, 64)
    player3NewCardImage1:SetPoint("BOTTOM", playerFrame, 25, 309)
    player3NewCardImage1.texture = player3NewCardImage1:CreateTexture()
    player3NewCardImage1.texture:SetAllPoints()
    player3NewCardImage1.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3cardImageFile1)
    player3NewCardImage1:Show()

    player3NewCardImage2 = CreateFrame("Frame", nil, playerFrame)
    player3NewCardImage2:SetSize(32, 64)
    player3NewCardImage2:SetPoint("BOTTOM", playerFrame, -17, 309)
    player3NewCardImage2.texture = player3NewCardImage2:CreateTexture()
    player3NewCardImage2.texture:SetAllPoints()
    player3NewCardImage2.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3cardImageFile2)
    player3NewCardImage2:Show()

end

-- Player 3 Split Function
function player3HandleSplit(message)
    player3PlaceSplitBet()
    local player3MainBetAmountValue = tonumber(string.match(player3MainBetAmount:GetText(), "%d+"))
    if player3MainBetAmountValue then
        player3SplitHand1BetText(player3MainBetAmountValue)
    end 

    player3PlaceSplitCards()

    -- A,A
    if playerFrame.player3CardTotalText:GetText() == "2 or 12" then
        playerFrame.player3SplitHand1CardTotalText:SetText("1 or 11")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("1 or 11")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 2,2
    elseif playerFrame.player3CardTotalText:GetText() == "4" then
        playerFrame.player3SplitHand1CardTotalText:SetText("2")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("2")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 3,3
    elseif playerFrame.player3CardTotalText:GetText() == "6" then
        playerFrame.player3SplitHand1CardTotalText:SetText("3")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("3")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 4,4
    elseif playerFrame.player3CardTotalText:GetText() == "8" then
        playerFrame.player3SplitHand1CardTotalText:SetText("4")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("4")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 5,5
    elseif playerFrame.player3CardTotalText:GetText() == "10" then
        playerFrame.player3SplitHand1CardTotalText:SetText("5")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("5")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 6,6
    elseif playerFrame.player3CardTotalText:GetText() == "12" then
        playerFrame.player3SplitHand1CardTotalText:SetText("6")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("6")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 7,7
    elseif playerFrame.player3CardTotalText:GetText() == "14" then
        playerFrame.player3SplitHand1CardTotalText:SetText("7")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("7")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 8,8
    elseif playerFrame.player3CardTotalText:GetText() == "16" then
        playerFrame.player3SplitHand1CardTotalText:SetText("8")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("8")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 9,9
    elseif playerFrame.player3CardTotalText:GetText() == "18" then
        playerFrame.player3SplitHand1CardTotalText:SetText("9")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("9")
        playerFrame.player3SplitHand2CardTotalText:Show()
    -- 10,10
    elseif playerFrame.player3CardTotalText:GetText() == "20" then
        playerFrame.player3SplitHand1CardTotalText:SetText("10")
        playerFrame.player3SplitHand1CardTotalText:Show()
        playerFrame.player3SplitHand2CardTotalText:SetText("10")
        playerFrame.player3SplitHand2CardTotalText:Show()
    end

    playerFrame.player3CardTotalText:SetText("")
    playerFrame.player3CardTotalText:Hide()
    
    if playerName == unitName3 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player3totalBetAmount = player3totalBetAmount + tonumber(player3MainBetAmountValue)
            bankingInfo.totalWagered = player3totalBetAmount
            player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3MainBetAmountValue)
            bankingInfo.bankrollTable = player3TotalBankrollAmount
        end
    end

    historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")
    bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
    cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

    player3SplitToggle = true

    if player3dealtCardsFrame:IsShown() then
        player3dealtCardsFrame:Hide()
        player3dealtCardsFrame.playerCardsButton:Hide()
        player3dealtCardsFrameSplitH1:Show()
        player3dealtCardsFrameSplitH1.playerH1CardsButton:Show()
        player3dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    end

end

-- Function to handle Player 3 PP Bet Image
local function player3PlaceCoinsPPBet(message)
    playerFrame.player3PPBetCoins:Show()
end

-- Function to handle Player 3 PP Bet Text
local function player3PlaceTextPPBet(message)
    local player3HistoryPPBet = string.match(message, "(%d+)G")

        if player3HistoryPPBet then
            player3PPBetAmount:SetText(player3HistoryPPBet .. " G")
            player3PPBetAmount:Show()

            if playerName == unitName3 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName3]
                    player3totalBetAmount = player3totalBetAmount + tonumber(player3HistoryPPBet)
                    bankingInfo.totalWagered = player3totalBetAmount
                end
            end

            historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")

        else
    end
end

-- Function to handle Player 3 21+3 Bet Image
local function player3PlaceCoins213Bet(message)
    playerFrame.player3213BetCoins:Show()
end

-- Function to handle Player 3 21+3 Bet Text
local function player3PlaceText213Bet(message)
    local player3History213Bet = string.match(message, "(%d+)G")

        if player3History213Bet then
            player3213BetAmount:SetText(player3History213Bet .. " G")
            player3213BetAmount:Show()

            if playerName == unitName3 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName3]
                    player3totalBetAmount = player3totalBetAmount + tonumber(player3History213Bet)
                    bankingInfo.totalWagered = player3totalBetAmount
                end
            end

            historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")

        else
    end
end

local function player3PreloadBet()
    
    player3MainBet = tonumber(player3PreloadEditBoxMainBet:GetText()) or 0
    player3PPBet = tonumber(player3PreloadEditBoxPPBet:GetText()) or 0
    player3213Bet = tonumber(player3PreloadEditBox213Bet:GetText()) or 0

    player3TotalRebetAmount = player3MainBet + player3PPBet + player3213Bet

    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3currentBankroll - player3TotalRebetAmount < 0 then
        print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
    else
        local player3Threshold = minBetMain - 1
        if player3MainBet <= player3Threshold then
            print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
        else
            if player3MainBet and player3MainBet >= minBetMain and player3MainBet <= maxBetMain then
                PlaySoundFile(soundFilePaths[33])
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P3] Placing a " ..player3MainBet.. "G main bet.", "RAID")
                -- Disable the edit box and button
                player3PreloadEditBoxMainBet:SetFocus(false)
                player3PreloadEditBoxMainBet:ClearFocus()
                player3MainBetEditBox:SetText("")
                player3MainBetEditBox:SetText(player3MainBet)
                player3MainBetEditBox:SetFocus(false)
                player3MainBetEditBox:ClearFocus()
                player3MainBetEditBox:Disable()
                player3ConfirmMainBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3MainBet)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end
            end

            if player3PPBet and player3PPBet >= minBetPP and player3PPBet <= maxBetPP then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P3] Placing a " ..player3PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player3PreloadEditBoxPPBet:SetFocus(false)
                player3PreloadEditBoxPPBet:ClearFocus()
                player3PPBetEditBox:SetText("")
                player3PPBetEditBox:SetText(player3PPBet)
                player3PPBetEditBox:SetFocus(false)
                player3PPBetEditBox:ClearFocus()
                player3PPBetEditBox:Disable()
                player3ConfirmPPBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3PPBet)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end
            end

            if player3213Bet and player3213Bet >= minBet213 and player3213Bet <= maxBet213 then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P3] Placing a " ..player3213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player3PreloadEditBox213Bet:SetFocus(false)
                player3PreloadEditBox213Bet:ClearFocus()
                player3213BetEditBox:SetText("")
                player3213BetEditBox:SetText(player3213Bet)
                player3213BetEditBox:SetFocus(false)
                player3213BetEditBox:ClearFocus()
                player3213BetEditBox:Disable()
                player3Confirm213BetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3213Bet)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end
            end
            
            player3PreloadBetButton:Disable()

        end

        bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

    end

end

-- Function to handle the Player 1 Main "Bet" button click
local function player3ConfirmMainBetClick()
    player3MainBet = tonumber(player3MainBetEditBox:GetText())
    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3MainBet and player3MainBet >= minBetMain and player3MainBet <= maxBetMain then
        if player3currentBankroll - player3MainBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            -- Valid bet amount, send the message with the bet
            SendChatMessage("[P3] Placing a " ..player3MainBet.. "G main bet.", "RAID")
            -- Disable the edit box and button
            player3MainBetEditBox:SetFocus(false)
            player3MainBetEditBox:ClearFocus()
            player3MainBetEditBox:Disable()
            player3ConfirmMainBetButton:Disable()

            player3PreloadBetButton:Disable()

            PlaySoundFile(soundFilePaths[33]) 

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3MainBet)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetMain .. "G and " .. maxBetMain .. "G.")
    end

end

-- Function to handle the Player 1 PP "Bet" button click
local function player3ConfirmPPBetClick()
    player3PPBet = tonumber(player3PPBetEditBox:GetText()) -- Get the entered bet amount
    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3PPBet and player3PPBet >= minBetPP and player3PPBet <= maxBetPP then
        if player3currentBankroll - player3PPBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player3Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P3] Placing a " ..player3PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player3PPBetEditBox:SetFocus(false)
                player3PPBetEditBox:ClearFocus()
                player3PPBetEditBox:Disable()
                player3ConfirmPPBetButton:Disable()

                player3PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3PPBet)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end

                bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
                cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetPP .. "G and " .. maxBetPP .. "G.")
    end

end

-- Function to handle the Player 1 21+3 "Bet" button click
local function player3Confirm213BetClick()
    player3213Bet = tonumber(player3213BetEditBox:GetText()) -- Get the entered bet amount
    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3213Bet and player3213Bet >= minBet213 and player3213Bet <= maxBet213 then
        if player3currentBankroll - player3213Bet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player3Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P3] Placing a " ..player3213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player3213BetEditBox:SetFocus(false)
                player3213BetEditBox:ClearFocus()
                player3213BetEditBox:Disable()
                player3Confirm213BetButton:Disable()

                player3PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3213Bet)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end

                bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
                cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBet213 .. "G and " .. maxBet213 .. "G.")
    end
 
end

-- Player 3 Main "Bet" button
player3ConfirmMainBetButton:SetScript("OnClick", player3ConfirmMainBetClick)

-- Player 3 PP "Bet" button
player3ConfirmPPBetButton:SetScript("OnClick", player3ConfirmPPBetClick)

-- Player 3 21+3 "Bet" button
player3Confirm213BetButton:SetScript("OnClick", player3Confirm213BetClick)

-- Player 3 "Bet All" Preload button
player3PreloadBetButton:SetScript("OnClick", player3PreloadBet)

local function player3resetRaidChannel()
    if playerName == unitName3 then
        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/raid", chatFrame)
        
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:SetText("")
        editBox:Insert("/raid")
        
        ChatEdit_SendText(editBox)
        ChatEdit_DeactivateChat(editBox)
    else
        print("")
    end
end

player3HotstreakImage1 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage1:SetSize(36, 36)
player3HotstreakImage1:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak1.tga")
player3HotstreakImage1:SetDrawLayer("OVERLAY")
player3HotstreakImage1:Hide()

player3HotstreakImage2 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage2:SetSize(36, 36)
player3HotstreakImage2:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak2.tga")
player3HotstreakImage2:SetDrawLayer("OVERLAY")
player3HotstreakImage2:Hide()

player3HotstreakImage3 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage3:SetSize(36, 36)
player3HotstreakImage3:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak3.tga")
player3HotstreakImage3:SetDrawLayer("OVERLAY")
player3HotstreakImage3:Hide()

player3HotstreakImage4 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage4:SetSize(36, 36)
player3HotstreakImage4:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak4.tga")
player3HotstreakImage4:SetDrawLayer("OVERLAY")
player3HotstreakImage4:Hide()

player3HotstreakImage5 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage5:SetSize(36, 36)
player3HotstreakImage5:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak5.tga")
player3HotstreakImage5:SetDrawLayer("OVERLAY")
player3HotstreakImage5:Hide()

player3HotstreakImage6 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage6:SetSize(36, 36)
player3HotstreakImage6:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak6.tga")
player3HotstreakImage6:SetDrawLayer("OVERLAY")
player3HotstreakImage6:Hide()

player3HotstreakImage7 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage7:SetSize(36, 36)
player3HotstreakImage7:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak7.tga")
player3HotstreakImage7:SetDrawLayer("OVERLAY")
player3HotstreakImage7:Hide()

player3HotstreakImage8 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage8:SetSize(36, 36)
player3HotstreakImage8:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage8:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak8.tga")
player3HotstreakImage8:SetDrawLayer("OVERLAY")
player3HotstreakImage8:Hide()

player3HotstreakImage9 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage9:SetSize(36, 36)
player3HotstreakImage9:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage9:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak9.tga")
player3HotstreakImage9:SetDrawLayer("OVERLAY")
player3HotstreakImage9:Hide()

player3HotstreakImage10 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage10:SetSize(36, 36)
player3HotstreakImage10:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage10:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak10.tga")
player3HotstreakImage10:SetDrawLayer("OVERLAY")
player3HotstreakImage10:Hide()

player3HotstreakImage11 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage11:SetSize(36, 36)
player3HotstreakImage11:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage11:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak11.tga")
player3HotstreakImage11:SetDrawLayer("OVERLAY")
player3HotstreakImage11:Hide()

player3HotstreakImage12 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage12:SetSize(36, 36)
player3HotstreakImage12:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage12:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak12.tga")
player3HotstreakImage12:SetDrawLayer("OVERLAY")
player3HotstreakImage12:Hide()

player3HotstreakImage13 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage13:SetSize(36, 36)
player3HotstreakImage13:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage13:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak13.tga")
player3HotstreakImage13:SetDrawLayer("OVERLAY")
player3HotstreakImage13:Hide()

player3HotstreakImage14 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage14:SetSize(36, 36)
player3HotstreakImage14:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage14:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak14.tga")
player3HotstreakImage14:SetDrawLayer("OVERLAY")
player3HotstreakImage14:Hide()

player3HotstreakImage15 = playerFrame:CreateTexture(nil, "OVERLAY")
player3HotstreakImage15:SetSize(36, 36)
player3HotstreakImage15:SetPoint("CENTER", playerFrame, -83, -276)
player3HotstreakImage15:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak15.tga")
player3HotstreakImage15:SetDrawLayer("OVERLAY")
player3HotstreakImage15:Hide()

local function player3HotStreakCheck()
    if player3Hotstreak == 0 then
        player3HotstreakImage1:Hide()
        player3HotstreakImage2:Hide()
        player3HotstreakImage3:Hide()
        player3HotstreakImage4:Hide()
        player3HotstreakImage5:Hide()
        player3HotstreakImage6:Hide()
        player3HotstreakImage7:Hide()
        player3HotstreakImage8:Hide()
        player3HotstreakImage9:Hide()
        player3HotstreakImage10:Hide()
        player3HotstreakImage11:Hide()
        player3HotstreakImage12:Hide()
        player3HotstreakImage13:Hide()
        player3HotstreakImage14:Hide()
        player3HotstreakImage15:Hide()
    elseif player3Hotstreak == 1 then
        player3HotstreakImage1:Show()
    elseif player3Hotstreak == 2 then
        player3HotstreakImage1:Hide()
        player3HotstreakImage2:Show()
    elseif player3Hotstreak == 3 then
        player3HotstreakImage1:Hide()
        player3HotstreakImage2:Hide()
        player3HotstreakImage3:Show()
    elseif player3Hotstreak == 4 then
        player3HotstreakImage2:Hide()
        player3HotstreakImage3:Hide()
        player3HotstreakImage4:Show()
    elseif player3Hotstreak == 5 then
        player3HotstreakImage3:Hide()
        player3HotstreakImage4:Hide()
        player3HotstreakImage5:Show()
    elseif player3Hotstreak == 6 then
        player3HotstreakImage4:Hide()
        player3HotstreakImage5:Hide()
        player3HotstreakImage6:Show()
    elseif player3Hotstreak == 7 then
        player3HotstreakImage5:Hide()
        player3HotstreakImage6:Hide()
        player3HotstreakImage7:Show()
    elseif player3Hotstreak == 8 then
        player3HotstreakImage6:Hide()
        player3HotstreakImage7:Hide()
        player3HotstreakImage8:Show()
    elseif player3Hotstreak == 9 then
        player3HotstreakImage7:Hide()
        player3HotstreakImage8:Hide()
        player3HotstreakImage9:Show()
    elseif player3Hotstreak == 10 then
        player3HotstreakImage8:Hide()
        player3HotstreakImage9:Hide()
        player3HotstreakImage10:Show()
    elseif player3Hotstreak == 11 then
        player3HotstreakImage9:Hide()
        player3HotstreakImage10:Hide()
        player3HotstreakImage11:Show()
    elseif player3Hotstreak == 12 then
        player3HotstreakImage10:Hide()
        player3HotstreakImage11:Hide()
        player3HotstreakImage12:Show()
    elseif player3Hotstreak == 13 then
        player3HotstreakImage11:Hide()
        player3HotstreakImage12:Hide()
        player3HotstreakImage13:Show()
    elseif player3Hotstreak == 14 then
        player3HotstreakImage12:Hide()
        player3HotstreakImage13:Hide()
        player3HotstreakImage14:Show()
    elseif player3Hotstreak == 15 then
        player3HotstreakImage13:Hide()
        player3HotstreakImage14:Hide()
        player3HotstreakImage15:Show()
    end
end

-- Function to handle Player 3 PP Win Image
function player3PlaceBetsPPWin(message)
    playerFrame.player3PPBetCoins:Hide()
    playerFrame.player3PPWinCoins:Show()
    player3PPBetAmount:SetPoint("CENTER", playerFrame, -51, -18)
end

-- Function to handle Player 3 21+3 Win Image
function player3PlaceBets213Win(message)
    playerFrame.player3213BetCoins:Hide()
    playerFrame.player3213WinCoins:Show()
    player3213BetAmount:SetPoint("CENTER", playerFrame, 67, -19)
end

function player3MixedPairWin(message)

    if playerName == unitName3 then
        player3PPBetAmountValue = tonumber(string.match(player3PPBetEditBox:GetText(), "%d+"))
        if player3PPBetAmountValue then
            player3NewPPAmount = player3PPBetAmountValue * mixedPairPayoutReturn
            player3PPBetAmount:SetText(player3NewPPAmount .. " G")
            player3PPBetAmount:SetTextColor(0, 1, 0)

            player3PPProfitvalue = player3NewPPAmount - player3PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3totalWin = player3totalWin + tonumber(player3PPProfitvalue)
                    bankingInfo.totalWon = player3totalWin
                    player3totalProfit = player3totalProfit + tonumber(player3PPProfitvalue)
                    bankingInfo.totalProfit = player3totalProfit
                    player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3NewPPAmount)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3PPBetAmountValue = tonumber(string.match(player3PPBetAmount:GetText(), "%d+"))
        if player3PPBetAmountValue then
            player3NewPPAmount = player3PPBetAmountValue * mixedPairPayoutReturn
            player3PPBetAmount:SetText(player3NewPPAmount .. " G")
            player3PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBetsPPWin()
    player3PPSideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3NewPPAmount)

end

function player3ColouredPairWin(message)

    if playerName == unitName3 then
        player3PPBetAmountValue = tonumber(string.match(player3PPBetEditBox:GetText(), "%d+"))
        if player3PPBetAmountValue then
            player3NewPPAmount = player3PPBetAmountValue * colouredPairPayoutReturn
            player3PPBetAmount:SetText(player3NewPPAmount .. " G")
            player3PPBetAmount:SetTextColor(0, 1, 0)

            player3PPProfitvalue = player3NewPPAmount - player3PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3totalWin = player3totalWin + tonumber(player3PPProfitvalue)
                    bankingInfo.totalWon = player3totalWin
                    player3totalProfit = player3totalProfit + tonumber(player3PPProfitvalue)
                    bankingInfo.totalProfit = player3totalProfit
                    player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3NewPPAmount)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3PPBetAmountValue = tonumber(string.match(player3PPBetAmount:GetText(), "%d+"))
        if player3PPBetAmountValue then
            player3NewPPAmount = player3PPBetAmountValue * colouredPairPayoutReturn
            player3PPBetAmount:SetText(player3NewPPAmount .. " G")
            player3PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBetsPPWin()
    player3PPSideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3NewPPAmount)

end

function player3PerfectPairWin(message)

    if playerName == unitName3 then
        player3PPBetAmountValue = tonumber(string.match(player3PPBetEditBox:GetText(), "%d+"))
        if player3PPBetAmountValue then
            player3NewPPAmount = player3PPBetAmountValue * perfectPairPayoutReturn
            player3PPBetAmount:SetText(player3NewPPAmount .. " G")
            player3PPBetAmount:SetTextColor(0, 1, 0)

            player3PPProfitvalue = player3NewPPAmount - player3PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3totalWin = player3totalWin + tonumber(player3PPProfitvalue)
                    bankingInfo.totalWon = player3totalWin
                    player3totalProfit = player3totalProfit + tonumber(player3PPProfitvalue)
                    bankingInfo.totalProfit = player3totalProfit
                    player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3NewPPAmount)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3PPBetAmountValue = tonumber(string.match(player3PPBetAmount:GetText(), "%d+"))
        if player3PPBetAmountValue then
            player3NewPPAmount = player3PPBetAmountValue * perfectPairPayoutReturn
            player3PPBetAmount:SetText(player3NewPPAmount .. " G")
            player3PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBetsPPWin()
    player3PPSideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3NewPPAmount)

end

function player3SuitedThreeOfAKindWin(message)

    if playerName == unitName3 then
        player3213BetAmountValue = tonumber(string.match(player3213BetEditBox:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)

            player3213Profitvalue = player3New213Amount - player3213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalWin = player3totalWin + tonumber(player3213Profitvalue)
                bankingInfo.totalWon = player3totalWin
                player3totalProfit = player3totalProfit + tonumber(player3213Profitvalue)
                bankingInfo.totalProfit = player3totalProfit
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3New213Amount)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3213BetAmountValue = tonumber(string.match(player3213BetAmount:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBets213Win()
    player3213SideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3New213Amount)

end

function player3StraightFlushWin(message)

    if playerName == unitName3 then
        player3213BetAmountValue = tonumber(string.match(player3213BetEditBox:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * straightFlushPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)

            player3213Profitvalue = player3New213Amount - player3213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalWin = player3totalWin + tonumber(player3213Profitvalue)
                bankingInfo.totalWon = player3totalWin
                player3totalProfit = player3totalProfit + tonumber(player3213Profitvalue)
                bankingInfo.totalProfit = player3totalProfit
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3New213Amount)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3213BetAmountValue = tonumber(string.match(player3213BetAmount:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * straightFlushPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBets213Win()
    player3213SideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3New213Amount)

end

function player3ThreeOfAKindWin(message)

    if playerName == unitName3 then
        player3213BetAmountValue = tonumber(string.match(player3213BetEditBox:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * threeOfAKindPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)

            player3213Profitvalue = player3New213Amount - player3213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalWin = player3totalWin + tonumber(player3213Profitvalue)
                bankingInfo.totalWon = player3totalWin
                player3totalProfit = player3totalProfit + tonumber(player3213Profitvalue)
                bankingInfo.totalProfit = player3totalProfit
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3New213Amount)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3213BetAmountValue = tonumber(string.match(player3213BetAmount:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * threeOfAKindPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBets213Win()
    player3213SideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3New213Amount)

end

function player3StraightWin(message)

    if playerName == unitName3 then
        player3213BetAmountValue = tonumber(string.match(player3213BetEditBox:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * straightPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)

            player3213Profitvalue = player3New213Amount - player3213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalWin = player3totalWin + tonumber(player3213Profitvalue)
                bankingInfo.totalWon = player3totalWin
                player3totalProfit = player3totalProfit + tonumber(player3213Profitvalue)
                bankingInfo.totalProfit = player3totalProfit
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3New213Amount)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3213BetAmountValue = tonumber(string.match(player3213BetAmount:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * straightPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBets213Win()
    player3213SideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3New213Amount)

end

function player3FlushWin(message)

    if playerName == unitName3 then
        player3213BetAmountValue = tonumber(string.match(player3213BetEditBox:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * flushPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)

            player3213Profitvalue = player3New213Amount - player3213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalWin = player3totalWin + tonumber(player3213Profitvalue)
                bankingInfo.totalWon = player3totalWin
                player3totalProfit = player3totalProfit + tonumber(player3213Profitvalue)
                bankingInfo.totalProfit = player3totalProfit
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3New213Amount)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end

            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        end
    else
        player3213BetAmountValue = tonumber(string.match(player3213BetAmount:GetText(), "%d+"))
        if player3213BetAmountValue then
            player3New213Amount = player3213BetAmountValue * flushPayoutReturn
            player3213BetAmount:SetText(player3New213Amount .. " G")
            player3213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player3PlaceBets213Win()
    player3213SideBetWin = true

    player3SessionWin = player3SessionWin + tonumber(player3New213Amount)

end

function player3Loss()
    player3MainBetValue = tonumber(string.match(player3MainBetAmount:GetText(), "%d+"))
    if player3MainBetValue then
        
        if playerName == unitName3 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalLoss = player3totalLoss + tonumber(player3MainBetValue)
                bankingInfo.totalLost = player3totalLoss
                player3totalProfit = player3totalProfit - tonumber(player3MainBetValue)
                bankingInfo.totalProfit = player3totalProfit
            end
        end

        if player3totalProfit >= 0 then
            historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
        historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")

        local player3PPBetText = player3PPBetAmount:GetText()

        if player3PPBetText and player3PPBetText ~= "" then
            player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
            
            if player3PPBetAmountValue then
                if player3PPSideBetWin == false then

                    player3PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")

                end
            end
        end

        local player3213BetText = player3213BetAmount:GetText()

        if player3213BetText and player3213BetText ~= "" then
            player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

            if player3213BetAmountValue then
                if player3213SideBetWin == false then

                    player3213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")

                end
            end
        end
    end
end

function player3SplitH1Loss()
    player3SplitHand1BetAmountValue = tonumber(string.match(player3SplitH1BetAmount:GetText(), "%d+"))
    if player3SplitHand1BetAmountValue then

        if playerName == unitName3 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalLoss = player3totalLoss + tonumber(player3SplitHand1BetAmountValue)
                bankingInfo.totalLost = player3totalLoss
                player3totalProfit = player3totalProfit - tonumber(player3SplitHand1BetAmountValue)
                bankingInfo.totalProfit = player3totalProfit
            end
        end

        historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
        historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")

        if player3totalProfit >= 0 then
            historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

    end
end

function player3SplitH2Loss()
    player3SplitHand2BetAmountValue = tonumber(string.match(player3SplitH2BetAmount:GetText(), "%d+"))
    if player3SplitHand2BetAmountValue then

        if playerName == unitName3 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalLoss = player3totalLoss + tonumber(player3SplitHand2BetAmountValue)
                bankingInfo.totalLost = player3totalLoss
                player3totalProfit = player3totalProfit - tonumber(player3SplitHand2BetAmountValue)
                bankingInfo.totalProfit = player3totalProfit
            end
        end

        historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
        historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")

        if player3totalProfit >= 0 then
            historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        local player3PPBetText = player3PPBetAmount:GetText()

        if player3PPBetText and player3PPBetText ~= "" then
            player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
            
            if player3PPBetAmountValue then
                if player3PPSideBetWin == false then

                    player3PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player3213BetText = player3213BetAmount:GetText()

        if player3213BetText and player3213BetText ~= "" then
            player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

            if player3213BetAmountValue then
                if player3213SideBetWin == false then

                    player3213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end
end

function player3Push()
    player3MainBetValue = tonumber(string.match(player3MainBetAmount:GetText(), "%d+"))
    if player3MainBetValue then


        if playerName == unitName3 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3MainBetValue)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end
        end

        bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

        local player3PPBetText = player3PPBetAmount:GetText()

        if player3PPBetText and player3PPBetText ~= "" then
            player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
            
            if player3PPBetAmountValue then
                if player3PPSideBetWin == false then

                    player3PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player3213BetText = player3213BetAmount:GetText()

        if player3213BetText and player3213BetText ~= "" then
            player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

            if player3213BetAmountValue then
                if player3213SideBetWin == false then

                    player3213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        player3SessionWin = player3SessionWin + tonumber(player3MainBetValue)

    end
end

function player3SplitH1Push()
    player3SplitHand1BetAmountValue = tonumber(string.match(player3SplitH1BetAmount:GetText(), "%d+"))
    if player3SplitHand1BetAmountValue then

        if playerName == unitName3 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3SplitHand1BetAmountValue)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end
        end

        bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
   
        player3SessionWin = player3SessionWin + tonumber(player3SplitHand1BetAmountValue)
    
    end
end

function player3SplitH2Push()
    player3SplitHand2BetAmountValue = tonumber(string.match(player3SplitH2BetAmount:GetText(), "%d+"))
    if player3SplitHand2BetAmountValue then

        if playerName == unitName3 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3SplitHand2BetAmountValue)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end
        end

        bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

        local player3PPBetText = player3PPBetAmount:GetText()

        if player3PPBetText and player3PPBetText ~= "" then
            player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
            
            if player3PPBetAmountValue then
                if player3PPSideBetWin == false then

                    player3PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player3213BetText = player3213BetAmount:GetText()

        if player3213BetText and player3213BetText ~= "" then
            player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

            if player3213BetAmountValue then
                if player3213SideBetWin == false then

                    player3213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    
        player3SessionWin = player3SessionWin + tonumber(player3SplitHand2BetAmountValue)
    
    end
end

function player3BJWin(message)
    player3MainBetAmountValue = tonumber(string.match(player3MainBetAmount:GetText(), "%d+"))
    if player3MainBetAmountValue then
        player3BJWinAmountValue = player3MainBetAmountValue * 2.5
        player3MainBetAmount:SetText(player3BJWinAmountValue .. " G")
    end

    player3BJProfitvalue = player3BJWinAmountValue - player3MainBetAmountValue

    if playerName == unitName3 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player3totalWin = player3totalWin + tonumber(player3BJProfitvalue)
            bankingInfo.totalWon = player3totalWin
            player3totalProfit = player3totalProfit + tonumber(player3BJProfitvalue)
            bankingInfo.totalProfit = player3totalProfit
            player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3BJWinAmountValue)
            bankingInfo.bankrollTable = player3TotalBankrollAmount
        end
    end

    if player3totalProfit >= 0 then
        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
    bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
    cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

    local player3PPBetText = player3PPBetAmount:GetText()

    if player3PPBetText and player3PPBetText ~= "" then
        player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
        
        if player3PPBetAmountValue then
            if player3PPSideBetWin == false then

                player3PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName3 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                        bankingInfo.totalLost = player3totalLoss
                        player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                        bankingInfo.totalProfit = player3totalProfit
                    end
                end
        
                historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
        
                if player3totalProfit >= 0 then
                    historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player3213BetText = player3213BetAmount:GetText()

    if player3213BetText and player3213BetText ~= "" then
        player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

        if player3213BetAmountValue then
            if player3213SideBetWin == false then

                player3213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName3 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                        bankingInfo.totalLost = player3totalLoss
                        player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                        bankingInfo.totalProfit = player3totalProfit
                    end
                end
        
                historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
        
                if player3totalProfit >= 0 then
                    historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player3MainBetCoins:Hide()
    playerFrame.player3BJWinCoins:Show()

    player3SessionWin = player3SessionWin + tonumber(player3BJWinAmountValue)

end

function player3SplitH1BJ(message)
    player3SplitHand1BetAmountValue = tonumber(string.match(player3SplitH1BetAmount:GetText(), "%d+"))
    if player3SplitHand1BetAmountValue then
        player3SplitHand1BJWinAmountValue = player3SplitHand1BetAmountValue * 2.5
        player3SplitH1BetAmount:SetText(player3SplitHand1BJWinAmountValue .. " G")
    end

    player3SplitHand1BJProfitValue = player3SplitHand1BJWinAmountValue - player3SplitHand1BetAmountValue

    if playerName == unitName3 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player3totalWin = player3totalWin + tonumber(player3SplitHand1BJProfitValue)
            bankingInfo.totalWon = player3totalWin
            player3totalProfit = player3totalProfit + tonumber(player3SplitHand1BJProfitValue)
            bankingInfo.totalProfit = player3totalProfit
            player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3SplitHand1BJWinAmountValue)
            bankingInfo.bankrollTable = player3TotalBankrollAmount
        end
    end

    if player3totalProfit >= 0 then
        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
    bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
    cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

    playerFrame.player3SplitHand1Coins:Hide()
    playerFrame.player3SplitHand1BJWinCoins:Show()

    player3SessionWin = player3SessionWin + tonumber(player3SplitHand1BJWinAmountValue)

end

function player3SplitH2BJ(message)
    player3SplitHand2BetAmountValue = tonumber(string.match(player3SplitH2BetAmount:GetText(), "%d+"))
    if player3SplitHand2BetAmountValue then
        player3SplitHand2BJWinAmountValue = player3SplitHand2BetAmountValue * 2.5
        player3SplitH2BetAmount:SetText(player3SplitHand2BJWinAmountValue .. " G")
    end

    player3SplitHand2BJProfitValue = player3SplitHand2BJWinAmountValue - player3SplitHand2BetAmountValue

    if playerName == unitName3 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player3totalWin = player3totalWin + tonumber(player3SplitHand2BJProfitValue)
            bankingInfo.totalWon = player3totalWin
            player3totalProfit = player3totalProfit + tonumber(player3SplitHand2BJProfitValue)
            bankingInfo.totalProfit = player3totalProfit
            player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3SplitHand2BJWinAmountValue)
            bankingInfo.bankrollTable = player3TotalBankrollAmount
        end
    end

    if player3totalProfit >= 0 then
        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
    bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
    cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

    local player3PPBetText = player3PPBetAmount:GetText()

    if player3PPBetText and player3PPBetText ~= "" then
        player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
        
        if player3PPBetAmountValue then
            if player3PPSideBetWin == false then

                player3PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName3 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                        bankingInfo.totalLost = player3totalLoss
                        player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                        bankingInfo.totalProfit = player3totalProfit
                    end
                end
        
                historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
        
                if player3totalProfit >= 0 then
                    historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player3213BetText = player3213BetAmount:GetText()

    if player3213BetText and player3213BetText ~= "" then
        player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

        if player3213BetAmountValue then
            if player3213SideBetWin == false then

                player3213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName3 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                        bankingInfo.totalLost = player3totalLoss
                        player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                        bankingInfo.totalProfit = player3totalProfit
                    end
                end
        
                historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
        
                if player3totalProfit >= 0 then
                    historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player3SplitHand2Coins:Hide()
    playerFrame.player3SplitHand2BJWinCoins:Show()

    player3SessionWin = player3SessionWin + tonumber(player3SplitHand2BJWinAmountValue)

end

function player3Win(message)
    player3MainBetAmountValue = tonumber(string.match(player3MainBetAmount:GetText(), "%d+"))
    if player3MainBetAmountValue then
        player3NormalWinAmountValue = player3MainBetAmountValue * 2
        player3MainBetAmount:SetText(player3NormalWinAmountValue .. " G")

        if playerName == unitName3 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player3totalWin = player3totalWin + tonumber(player3MainBetAmountValue)
                bankingInfo.totalWon = player3totalWin
                player3totalProfit = player3totalProfit + tonumber(player3MainBetAmountValue)
                bankingInfo.totalProfit = player3totalProfit
                player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3NormalWinAmountValue)
                bankingInfo.bankrollTable = player3TotalBankrollAmount
            end
        end
    
        if player3totalProfit >= 0 then
            historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end
    
        historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
        historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
        bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

        local player3PPBetText = player3PPBetAmount:GetText()

        if player3PPBetText and player3PPBetText ~= "" then
            player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
            
            if player3PPBetAmountValue then
                if player3PPSideBetWin == false then

                    player3PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player3213BetText = player3213BetAmount:GetText()

        if player3213BetText and player3213BetText ~= "" then
            player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

            if player3213BetAmountValue then
                if player3213SideBetWin == false then

                    player3213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName3 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                            bankingInfo.totalLost = player3totalLoss
                            player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                            bankingInfo.totalProfit = player3totalProfit
                        end
                    end
            
                    historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            
                    if player3totalProfit >= 0 then
                        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end

    playerFrame.player3MainBetCoins:Hide()
    playerFrame.player3NormalWinCoins:Show()

    player3SessionWin = player3SessionWin + tonumber(player3NormalWinAmountValue)

end

function player3SplitH1Win(message)
    player3SplitHand1BetAmountValue = tonumber(string.match(player3SplitH1BetAmount:GetText(), "%d+"))
    if player3SplitHand1BetAmountValue then
        player3SplitHand1NormalWinAmountValue = player3SplitHand1BetAmountValue * 2
        player3SplitH1BetAmount:SetText(player3SplitHand1NormalWinAmountValue .. " G")
    end

    if playerName == unitName3 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player3totalWin = player3totalWin + tonumber(player3SplitHand1BetAmountValue)
            bankingInfo.totalWon = player3totalWin
            player3totalProfit = player3totalProfit + tonumber(player3SplitHand1BetAmountValue)
            bankingInfo.totalProfit = player3totalProfit
            player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3SplitHand1NormalWinAmountValue)
            bankingInfo.bankrollTable = player3TotalBankrollAmount
        end
    end

    if player3totalProfit >= 0 then
        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
    bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
    cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

    playerFrame.player3SplitHand1Coins:Hide()
    playerFrame.player3SplitHand1NormalWinCoins:Show()

    player3SessionWin = player3SessionWin + tonumber(player3SplitHand1NormalWinAmountValue)

end

function player3SplitH2Win(message)
    player3SplitHand2BetAmountValue = tonumber(string.match(player3SplitH2BetAmount:GetText(), "%d+"))
    if player3SplitHand2BetAmountValue then
        player3SplitHand2NormalWinAmountValue = player3SplitHand2BetAmountValue * 2
        player3SplitH2BetAmount:SetText(player3SplitHand2NormalWinAmountValue .. " G")
    end

    if playerName == unitName3 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player3totalWin = player3totalWin + tonumber(player3SplitHand2BetAmountValue)
            bankingInfo.totalWon = player3totalWin
            player3totalProfit = player3totalProfit + tonumber(player3SplitHand2BetAmountValue)
            bankingInfo.totalProfit = player3totalProfit
            player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3SplitHand2NormalWinAmountValue)
            bankingInfo.bankrollTable = player3TotalBankrollAmount
        end
    end

    if player3totalProfit >= 0 then
        historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
    historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
    bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
    cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

    local player3PPBetText = player3PPBetAmount:GetText()

    if player3PPBetText and player3PPBetText ~= "" then
        player3PPBetAmountValue = tonumber(string.match(player3PPBetText, "%d+"))
        
        if player3PPBetAmountValue then
            if player3PPSideBetWin == false then

                player3PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName3 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player3totalLoss = player3totalLoss + tonumber(player3PPBetAmountValue)
                        bankingInfo.totalLost = player3totalLoss
                        player3totalProfit = player3totalProfit - tonumber(player3PPBetAmountValue)
                        bankingInfo.totalProfit = player3totalProfit
                    end
                end
        
                historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
        
                if player3totalProfit >= 0 then
                    historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player3213BetText = player3213BetAmount:GetText()

    if player3213BetText and player3213BetText ~= "" then
        player3213BetAmountValue = tonumber(string.match(player3213BetText, "%d+"))

        if player3213BetAmountValue then
            if player3213SideBetWin == false then

                player3213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName3 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player3totalLoss = player3totalLoss + tonumber(player3213BetAmountValue)
                        bankingInfo.totalLost = player3totalLoss
                        player3totalProfit = player3totalProfit - tonumber(player3213BetAmountValue)
                        bankingInfo.totalProfit = player3totalProfit
                    end
                end
        
                historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
                historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
        
                if player3totalProfit >= 0 then
                    historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player3SplitHand2Coins:Hide()
    playerFrame.player3SplitHand2NormalWinCoins:Show()

    player3SessionWin = player3SessionWin + tonumber(player3SplitHand2NormalWinAmountValue)

end

function player3InsuranceWin(message)

    local player3InsuranceBetText = playerFrame.player3InsuranceBetAmount:GetText()

    if player3InsuranceBetText and player3InsuranceBetText ~= "" then
        player3InsuranceBetAmountValue = tonumber(string.match(player3InsuranceBetText, "%d+"))

        if player3InsuranceBetAmountValue then
            player3InsuranceWinAmountValue = player3InsuranceBetAmountValue * 3

            player3InsuranceProfitValue = player3InsuranceWinAmountValue - player3InsuranceBetAmountValue


            if playerName == unitName3 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3totalWin = player3totalWin + tonumber(player3InsuranceProfitValue)
                    bankingInfo.totalWon = player3totalWin
                    player3totalProfit = player3totalProfit + tonumber(player3InsuranceProfitValue)
                    bankingInfo.totalProfit = player3totalProfit
                    player3TotalBankrollAmount = player3TotalBankrollAmount + tonumber(player3InsuranceWinAmountValue)
                    bankingInfo.bankrollTable = player3TotalBankrollAmount
                end
            end
        
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
        
            historyFrame.player3totalWonAmount:SetText(player3totalWin .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")
            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")

            player3SessionWin = player3SessionWin + tonumber(player3InsuranceWinAmountValue)

        end
    end
end

function player3InsuranceLoss(message)

    local player3InsuranceBetText = playerFrame.player3InsuranceBetAmount:GetText()

    if player3InsuranceBetText and player3InsuranceBetText ~= "" then
        player3InsuranceBetAmountValue = tonumber(string.match(player3InsuranceBetText, "%d+"))

        if player3InsuranceBetAmountValue then

            if playerName == unitName3 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player3totalLoss = player3totalLoss + tonumber(player3InsuranceBetAmountValue)
                    bankingInfo.totalLost = player3totalLoss
                    player3totalProfit = player3totalProfit - tonumber(player3InsuranceBetAmountValue)
                    bankingInfo.totalProfit = player3totalProfit
                end
            end
    
            if player3totalProfit >= 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
    
            historyFrame.player3totalLostAmount:SetText(player3totalLoss .. " G")
            historyFrame.player3ProfitAmount:SetText(player3totalProfit .. " G")

        end
    end
end

local function player3SessionWinAnnouncement()
    if playerName == unitName3 then
        if player3SessionWinCalled == false then
            if player3SessionWin >= 2 then
                local chatFrame = SELECTED_DOCK_FRAME
                ChatFrame_OpenChat("/me", chatFrame)
                
                local editBox = _G[chatFrame:GetName().."EditBox"]
                editBox:SetText("")
                editBox:Insert("/me has won " .. player3SessionWin .. "g from a hand of Blackjack.")
                
                ChatEdit_SendText(editBox)
                ChatEdit_DeactivateChat(editBox)

                UpdateWinningsDisplay(playerFrame.player3WinningsUpdate, player3SessionWin)
                player3resetRaidChannel()
                
            else
                print("")
            end

            player3SessionWinCalled = true
        end
    end
end


















-- >>> PLAYER 4 <<<
-- >>> PLAYER 4 <<<
-- >>> PLAYER 4 <<<

playerFrame.player4CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", -210, 230)
playerFrame.player4CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 28, "OUTLINE") -- Adjust the font and size as needed
playerFrame.player4CardTotalText:SetText("")

playerFrame.player4SplitHand1CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4SplitHand1CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", -180, 224)
playerFrame.player4SplitHand1CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player4SplitHand1CardTotalText:SetText("")

playerFrame.player4SplitHand2CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4SplitHand2CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", -240, 247)
playerFrame.player4SplitHand2CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player4SplitHand2CardTotalText:SetText("")

-- Buttons for Player 4
-- Hit
playerFrame.player4HitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4HitButton:SetPoint("BOTTOM", playerFrame, -288, 135)
playerFrame.player4HitButton:SetSize(65, 30)
playerFrame.player4HitButton:SetText("Hit")
playerFrame.player4HitButton:Disable()
playerFrame.player4HitButton:Hide()
-- Stand
playerFrame.player4StandButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4StandButton:SetPoint("BOTTOM", playerFrame, -222, 135)
playerFrame.player4StandButton:SetSize(65, 30)
playerFrame.player4StandButton:SetText("Stand")
playerFrame.player4StandButton:Disable()
playerFrame.player4StandButton:Hide()
-- Double
playerFrame.player4DoubleButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4DoubleButton:SetPoint("BOTTOM", playerFrame, -288, 105)
playerFrame.player4DoubleButton:SetSize(65, 30)
playerFrame.player4DoubleButton:SetText("Double")
playerFrame.player4DoubleButton:Disable()
playerFrame.player4DoubleButton:Hide()
-- Split
playerFrame.player4SplitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4SplitButton:SetPoint("BOTTOM", playerFrame, -222, 105)
playerFrame.player4SplitButton:SetSize(65, 30)
playerFrame.player4SplitButton:SetText("Split")
playerFrame.player4SplitButton:Disable()
playerFrame.player4SplitButton:Hide()
-- Insurance Yes
playerFrame.player4InsuranceYesButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4InsuranceYesButton:SetPoint("BOTTOM", playerFrame, -320, 75)
playerFrame.player4InsuranceYesButton:SetSize(55, 30)
playerFrame.player4InsuranceYesButton:SetText("Yes")
playerFrame.player4InsuranceYesButton:Disable()
playerFrame.player4InsuranceYesButton:Hide()
-- Insurance No
playerFrame.player4InsuranceNoButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4InsuranceNoButton:SetPoint("BOTTOM", playerFrame, -195, 75)
playerFrame.player4InsuranceNoButton:SetSize(55, 30)
playerFrame.player4InsuranceNoButton:SetText("No")
playerFrame.player4InsuranceNoButton:Disable()
playerFrame.player4InsuranceNoButton:Hide()
-- Deal Now
playerFrame.player4DealNowButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4DealNowButton:SetPoint("BOTTOM", playerFrame, -255, 75)
playerFrame.player4DealNowButton:SetSize(85, 30)
playerFrame.player4DealNowButton:SetText("Deal Now")
playerFrame.player4DealNowButton:Disable()
playerFrame.player4DealNowButton:Hide()
-- Hit (Split H1)
playerFrame.player4HitButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4HitButtonSplitH1:SetPoint("BOTTOM", playerFrame, -225, 135)
playerFrame.player4HitButtonSplitH1:SetSize(65, 30)
playerFrame.player4HitButtonSplitH1:SetText("Hit")
playerFrame.player4HitButtonSplitH1:Disable()
playerFrame.player4HitButtonSplitH1:Hide()
-- Stand (Split H1)
playerFrame.player4StandButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4StandButtonSplitH1:SetPoint("BOTTOM", playerFrame, -225, 105)
playerFrame.player4StandButtonSplitH1:SetSize(65, 30)
playerFrame.player4StandButtonSplitH1:SetText("Stand")
playerFrame.player4StandButtonSplitH1:Disable()
playerFrame.player4StandButtonSplitH1:Hide()
-- Double (Split H1)
playerFrame.player4DoubleButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4DoubleButtonSplitH1:SetPoint("BOTTOM", playerFrame, -225, 75)
playerFrame.player4DoubleButtonSplitH1:SetSize(65, 30)
playerFrame.player4DoubleButtonSplitH1:SetText("Double")
playerFrame.player4DoubleButtonSplitH1:Disable()
playerFrame.player4DoubleButtonSplitH1:Hide()
-- Hit (Split H2)
playerFrame.player4HitButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4HitButtonSplitH2:SetPoint("BOTTOM", playerFrame, -291, 135)
playerFrame.player4HitButtonSplitH2:SetSize(65, 30)
playerFrame.player4HitButtonSplitH2:SetText("Hit")
playerFrame.player4HitButtonSplitH2:Disable()
playerFrame.player4HitButtonSplitH2:Hide()
-- Stand (Split H2)
playerFrame.player4StandButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4StandButtonSplitH2:SetPoint("BOTTOM", playerFrame, -291, 105)
playerFrame.player4StandButtonSplitH2:SetSize(65, 30)
playerFrame.player4StandButtonSplitH2:SetText("Stand")
playerFrame.player4StandButtonSplitH2:Disable()
playerFrame.player4StandButtonSplitH2:Hide()
-- Double (Split H2)
playerFrame.player4DoubleButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player4DoubleButtonSplitH2:SetPoint("BOTTOM", playerFrame, -291, 75)
playerFrame.player4DoubleButtonSplitH2:SetSize(65, 30)
playerFrame.player4DoubleButtonSplitH2:SetText("Double")
playerFrame.player4DoubleButtonSplitH2:Disable()
playerFrame.player4DoubleButtonSplitH2:Hide()
-- Main Bet Confirm
player4ConfirmMainBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player4ConfirmMainBetButton:SetPoint("BOTTOM", playerFrame, -222, 195)
player4ConfirmMainBetButton:SetSize(65, 30)
player4ConfirmMainBetButton:SetText("Bet")
player4ConfirmMainBetButton:Hide()
-- Perfect Pairs Confirm
player4ConfirmPPBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player4ConfirmPPBetButton:SetPoint("BOTTOM", playerFrame, -237, 295)
player4ConfirmPPBetButton:SetSize(43, 25)
player4ConfirmPPBetButton:SetText("Bet")
player4ConfirmPPBetButton:Hide()
-- 21+3 Confirm
player4Confirm213BetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player4Confirm213BetButton:SetPoint("BOTTOM", playerFrame, -121, 244)
player4Confirm213BetButton:SetSize(43, 25)
player4Confirm213BetButton:SetText("Bet")
player4Confirm213BetButton:Hide()

-- Wagers for Player 4
-- Main Bet
player4MainBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player4MainBetEditBox:SetSize(55, 30)
player4MainBetEditBox:SetPoint("BOTTOM", playerFrame, -284, 195)
player4MainBetEditBox:SetAutoFocus(false)
player4MainBetEditBox:SetNumeric(true)
player4MainBetEditBox:Hide()
-- Split Hand 1
player4SplitH1EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player4SplitH1EditBox:SetSize(55, 30)
player4SplitH1EditBox:SetPoint("BOTTOM", playerFrame, -219, 195)
player4SplitH1EditBox:SetAutoFocus(false)
player4SplitH1EditBox:SetNumeric(true)
player4SplitH1EditBox:ClearFocus()
player4SplitH1EditBox:Disable()
player4SplitH1EditBox:Hide()
-- Split Hand 2
player4SplitH2EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player4SplitH2EditBox:SetSize(55, 30)
player4SplitH2EditBox:SetPoint("BOTTOM", playerFrame, -284, 195)
player4SplitH2EditBox:SetAutoFocus(false)
player4SplitH2EditBox:SetNumeric(true)
player4SplitH2EditBox:ClearFocus()
player4SplitH2EditBox:Disable()
player4SplitH2EditBox:Hide()
-- Perfect Pairs
player4PPBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player4PPBetEditBox:SetSize(35, 30)
player4PPBetEditBox:SetPoint("BOTTOM", playerFrame, -235, 315)
player4PPBetEditBox:SetAutoFocus(false)
player4PPBetEditBox:SetNumeric(true)
player4PPBetEditBox:Hide()
-- 21+3
player4213BetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player4213BetEditBox:SetSize(35, 30)
player4213BetEditBox:SetPoint("BOTTOM", playerFrame, -119, 264)
player4213BetEditBox:SetAutoFocus(false)
player4213BetEditBox:SetNumeric(true)
player4213BetEditBox:Hide()

-- Labels for Player 4
-- Main Bet
playerFrame.player4MainBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4MainBetTitle:SetPoint("BOTTOM", playerFrame, -284, 222)
playerFrame.player4MainBetTitle:SetJustifyH("CENTER")
playerFrame.player4MainBetTitle:SetText("Main Bet")
playerFrame.player4MainBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player4MainBetTitle:Hide()
-- Split Hand 1
playerFrame.player4SplitH1Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4SplitH1Title:SetPoint("BOTTOM", playerFrame, -219, 222)
playerFrame.player4SplitH1Title:SetJustifyH("CENTER")
playerFrame.player4SplitH1Title:SetText("Hand 1")
playerFrame.player4SplitH1Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player4SplitH1Title:Hide()
-- Split Hand 2
playerFrame.player4SplitH2Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4SplitH2Title:SetPoint("BOTTOM", playerFrame, -284, 222)
playerFrame.player4SplitH2Title:SetJustifyH("CENTER")
playerFrame.player4SplitH2Title:SetText("Hand 2")
playerFrame.player4SplitH2Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player4SplitH2Title:Hide()
-- Main Bet Amount
player4MainBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4MainBetAmount:SetPoint("CENTER", playerFrame, -179, -18)
player4MainBetAmount:SetJustifyH("CENTER")
player4MainBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 1 Amount
player4SplitH1BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4SplitH1BetAmount:SetPoint("CENTER", playerFrame, -158, -23)
player4SplitH1BetAmount:SetJustifyH("CENTER")
player4SplitH1BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 2 Amount
player4SplitH2BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4SplitH2BetAmount:SetPoint("CENTER", playerFrame, -191, -8)
player4SplitH2BetAmount:SetJustifyH("CENTER")
player4SplitH2BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Perfect Pairs
playerFrame.player4PPBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4PPBetTitle:SetPoint("BOTTOM", playerFrame, -270, 312)
playerFrame.player4PPBetTitle:SetJustifyH("CENTER")
playerFrame.player4PPBetTitle:SetText("PP")
playerFrame.player4PPBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player4PPBetTitle:Hide()
-- Perfect Pairs Amount
player4PPBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4PPBetAmount:SetPoint("CENTER", playerFrame, -219, 26)
player4PPBetAmount:SetJustifyH("CENTER")
player4PPBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- 21+3
playerFrame.player4213BetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4213BetTitle:SetPoint("BOTTOM", playerFrame, -75, 259)
playerFrame.player4213BetTitle:SetJustifyH("CENTER")
playerFrame.player4213BetTitle:SetText("21+3")
playerFrame.player4213BetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player4213BetTitle:Hide()
-- 21+3 Amount
player4213BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player4213BetAmount:SetPoint("CENTER", playerFrame, -107, -25)
player4213BetAmount:SetJustifyH("CENTER")
player4213BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Insurance Amount
playerFrame.player4InsuranceBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4InsuranceBetAmount:SetPoint("CENTER", playerFrame, -149, -250)
playerFrame.player4InsuranceBetAmount:SetJustifyH("CENTER")
playerFrame.player4InsuranceBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE")
-- Player Name
playerFrame.player4Name = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4Name:SetPoint("BOTTOM", playerFrame, -255, 171)
playerFrame.player4Name:SetText("Seat Empty")
playerFrame.player4Name:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
-- Insurance
playerFrame.player4InsuranceTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4InsuranceTitle:SetPoint("BOTTOM", playerFrame, -255, 89)
playerFrame.player4InsuranceTitle:SetText("Insurance")
playerFrame.player4InsuranceTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
playerFrame.player4InsuranceTitle:Hide()
-- Insurance (if available)
playerFrame.player4InsuranceSubtitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4InsuranceSubtitle:SetPoint("BOTTOM", playerFrame, -255, 79)
playerFrame.player4InsuranceSubtitle:SetText("(if available)")
playerFrame.player4InsuranceSubtitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player4InsuranceSubtitle:Hide()
-- Session Win Update
playerFrame.player4WinningsUpdate = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player4WinningsUpdate:SetPoint("BOTTOMLEFT", playerFrame, 270, 30) 
playerFrame.player4WinningsUpdate:SetText("")
playerFrame.player4WinningsUpdate:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
playerFrame.player4WinningsUpdate:SetTextColor(0.118, 0.839, 0.412)

-- Images for Player 4
-- Turn Arrow
playerFrame.player4TurnArrow = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4TurnArrow:SetSize(128, 128)
playerFrame.player4TurnArrow:SetPoint("CENTER", playerFrame, -146, -158)
playerFrame.player4TurnArrow:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\TurnArrow.tga")
playerFrame.player4TurnArrow:SetBlendMode("BLEND")
playerFrame.player4TurnArrow:SetDrawLayer("OVERLAY")
playerFrame.player4TurnArrow:Hide()
-- Main Bet
playerFrame.player4MainBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4MainBetCoins:SetSize(128, 128)
playerFrame.player4MainBetCoins:SetPoint("CENTER", playerFrame, -163, -48)
playerFrame.player4MainBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player4MainBetCoins:SetBlendMode("BLEND")
playerFrame.player4MainBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player4MainBetCoins:Hide()
-- Win
playerFrame.player4NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4NormalWinCoins:SetSize(128, 128)
playerFrame.player4NormalWinCoins:SetPoint("CENTER", playerFrame, -163, -48)
playerFrame.player4NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player4NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player4NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4NormalWinCoins:Hide()
-- Split Hand 2 Bet
playerFrame.player4SplitHand2Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand2Coins:SetSize(128, 128)
playerFrame.player4SplitHand2Coins:SetPoint("CENTER", playerFrame, -175, -40)
playerFrame.player4SplitHand2Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player4SplitHand2Coins:SetBlendMode("BLEND")
playerFrame.player4SplitHand2Coins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand2Coins:Hide()
-- Split Double Hand 2 Bet
playerFrame.player4SplitHand2DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand2DoubleCoins:SetSize(128, 128)
playerFrame.player4SplitHand2DoubleCoins:SetPoint("CENTER", playerFrame, -175, -40)
playerFrame.player4SplitHand2DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player4SplitHand2DoubleCoins:SetBlendMode("BLEND")
playerFrame.player4SplitHand2DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand2DoubleCoins:Hide()
-- Split Win Hand 2
playerFrame.player4SplitHand2NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand2NormalWinCoins:SetSize(128, 128)
playerFrame.player4SplitHand2NormalWinCoins:SetPoint("CENTER", playerFrame, -175, -40)
playerFrame.player4SplitHand2NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player4SplitHand2NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player4SplitHand2NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand2NormalWinCoins:Hide()
-- Split Hand 1 Bet
playerFrame.player4SplitHand1Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand1Coins:SetSize(128, 128)
playerFrame.player4SplitHand1Coins:SetPoint("CENTER", playerFrame, -143, -55)
playerFrame.player4SplitHand1Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player4SplitHand1Coins:SetBlendMode("BLEND")
playerFrame.player4SplitHand1Coins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand1Coins:Hide()
-- Split Double Hand 1 Bet
playerFrame.player4SplitHand1DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand1DoubleCoins:SetSize(128, 128)
playerFrame.player4SplitHand1DoubleCoins:SetPoint("CENTER", playerFrame, -143, -55)
playerFrame.player4SplitHand1DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player4SplitHand1DoubleCoins:SetBlendMode("BLEND")
playerFrame.player4SplitHand1DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand1DoubleCoins:Hide()
-- Split Win Hand 1
playerFrame.player4SplitHand1NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand1NormalWinCoins:SetSize(128, 128)
playerFrame.player4SplitHand1NormalWinCoins:SetPoint("CENTER", playerFrame, -143, -55)
playerFrame.player4SplitHand1NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player4SplitHand1NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player4SplitHand1NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand1NormalWinCoins:Hide()
-- Blackjack Win
playerFrame.player4BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4BJWinCoins:SetSize(128, 128)
playerFrame.player4BJWinCoins:SetPoint("CENTER", playerFrame, -163, -48)
playerFrame.player4BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player4BJWinCoins:SetBlendMode("BLEND")
playerFrame.player4BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4BJWinCoins:Hide()
-- Split BJ Win Hand 2
playerFrame.player4SplitHand2BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand2BJWinCoins:SetSize(128, 128)
playerFrame.player4SplitHand2BJWinCoins:SetPoint("CENTER", playerFrame, -175, -40)
playerFrame.player4SplitHand2BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player4SplitHand2BJWinCoins:SetBlendMode("BLEND")
playerFrame.player4SplitHand2BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand2BJWinCoins:Hide()
-- Split BJ Win Hand 1
playerFrame.player4SplitHand1BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4SplitHand1BJWinCoins:SetSize(128, 128)
playerFrame.player4SplitHand1BJWinCoins:SetPoint("CENTER", playerFrame, -143, -55)
playerFrame.player4SplitHand1BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player4SplitHand1BJWinCoins:SetBlendMode("BLEND")
playerFrame.player4SplitHand1BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4SplitHand1BJWinCoins:Hide()
-- Double Bet
playerFrame.player4DoubleBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4DoubleBetCoins:SetSize(128, 128)
playerFrame.player4DoubleBetCoins:SetPoint("CENTER", playerFrame, -163, -48)
playerFrame.player4DoubleBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player4DoubleBetCoins:SetBlendMode("BLEND")
playerFrame.player4DoubleBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player4DoubleBetCoins:Hide()
-- PP Bet
playerFrame.player4PPBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4PPBetCoins:SetSize(128, 128)
playerFrame.player4PPBetCoins:SetPoint("CENTER", playerFrame, -215, 8)
playerFrame.player4PPBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player4PPBetCoins:SetBlendMode("BLEND")
playerFrame.player4PPBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player4PPBetCoins:Hide()
-- 21+3 Bet
playerFrame.player4213BetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4213BetCoins:SetSize(128, 128)
playerFrame.player4213BetCoins:SetPoint("CENTER", playerFrame, -102, -44)
playerFrame.player4213BetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player4213BetCoins:SetBlendMode("BLEND")
playerFrame.player4213BetCoins:SetDrawLayer("OVERLAY")
playerFrame.player4213BetCoins:Hide()
-- PP Win
playerFrame.player4PPWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4PPWinCoins:SetSize(128, 128)
playerFrame.player4PPWinCoins:SetPoint("CENTER", playerFrame, -203, 14)
playerFrame.player4PPWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player4PPWinCoins:SetBlendMode("BLEND")
playerFrame.player4PPWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4PPWinCoins:Hide()
-- 21+3 Win
playerFrame.player4213WinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player4213WinCoins:SetSize(128, 128)
playerFrame.player4213WinCoins:SetPoint("CENTER", playerFrame, -92, -38)
playerFrame.player4213WinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player4213WinCoins:SetBlendMode("BLEND")
playerFrame.player4213WinCoins:SetDrawLayer("OVERLAY")
playerFrame.player4213WinCoins:Hide()
-- Insurance YES for Player 4
player4InsuranceYesIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player4InsuranceYesIcon:SetSize(24, 24)
player4InsuranceYesIcon:SetPoint("CENTER", playerFrame, -152, -270)
player4InsuranceYesIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceYes.tga")
player4InsuranceYesIcon:SetDrawLayer("OVERLAY")
player4InsuranceYesIcon:Hide()
-- Insurance NO for Player 4
player4InsuranceNoIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player4InsuranceNoIcon:SetSize(24, 24)
player4InsuranceNoIcon:SetPoint("CENTER", playerFrame, -152, -270)
player4InsuranceNoIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceNo.tga")
player4InsuranceNoIcon:SetDrawLayer("OVERLAY")
player4InsuranceNoIcon:Hide()

-- BJ Win Coins
local function player4PlaceCoinsBJWin(message)
    playerFrame.player4MainBetCoins:Hide()
    playerFrame.player4BJWinCoins:Show()
end

-- Regular Win Coins
local function player4PlaceCoinsRegularWin(message)
    playerFrame.player4MainBetCoins:Hide()
    playerFrame.player4DoubleBetCoins:Show()
end

-- Main Bet Coins
local function player4PlaceCoinsMainBet(message)
    playerFrame.player4MainBetCoins:Show()
end

-- Double Bet Coins
local function player4PlaceCoinsDoubleBet(message)
    playerFrame.player4MainBetCoins:Hide()
    playerFrame.player4DoubleBetCoins:Show()
end

-- Function to handle Player 4 Main Bet Text
local function player4PlaceTextMainBet(message)
    local player4HistoryMainBet = string.match(message, "(%d+)G")

        if player4HistoryMainBet then
            player4MainBetAmount:SetText(player4HistoryMainBet .. " G")
            player4MainBetAmount:Show()

            if playerName == unitName4 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName4]
                    player4totalBetAmount = player4totalBetAmount + tonumber(player4HistoryMainBet)
                    bankingInfo.totalWagered = player4totalBetAmount
                end
            end

            historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")

        else
    end
end

-- Player 4 Split Hand Bet Text
function player4SplitHand1BetText(Amount)
    player4MainBetAmount:Hide()
    player4MainBetAmount:SetText("")
    player4SplitH1BetAmount:SetText(Amount .. " G")
    player4SplitH1BetAmount:Show()
    player4SplitH2BetAmount:SetText(Amount .. " G")
    player4SplitH2BetAmount:Show()
end

-- Player 4 Split Bet Image
function player4PlaceSplitBet(message)
    playerFrame.player4MainBetCoins:Hide()
    playerFrame.player4SplitHand1Coins:Show()
    playerFrame.player4SplitHand2Coins:Show()
end

-- Player 4 Place Initial Card Images
function player4PlaceSplitCards(message)

    -- Players: 4
    if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
        drawnCards[1]:Hide()
        drawnCards[3]:Hide()
        player4cardName1 = dealtCards[1]
        player4cardName2 = dealtCards[3]
        turn = 8 -- Player 4: 2nd Card (Split H1)

    -- Players: 1, 4
    elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player4cardName1 = dealtCards[2]
        player4cardName2 = dealtCards[5]
        turn = 30 -- Player 4: 2nd Card (Split H1)
    -- Players: 2, 4
    elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player4cardName1 = dealtCards[2]
        player4cardName2 = dealtCards[5]
        turn = 30 -- Player 4: 2nd Card (Split H1)
    -- Players: 3, 4
    elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player4cardName1 = dealtCards[2]
        player4cardName2 = dealtCards[5]
        turn = 30 -- Player 4: 2nd Card (Split H1)
    -- Players: 4, 5
    elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
        drawnCards[1]:Hide()
        drawnCards[4]:Hide()
        player4cardName1 = dealtCards[1]
        player4cardName2 = dealtCards[4]
        turn = 10 -- Player 4: 2nd Card (Split H1)

    -- Players: 1, 2, 4
    elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player4cardName1 = dealtCards[3]
        player4cardName2 = dealtCards[7]
        turn = 52 -- Player 4: 2nd Card (Split H1)
    -- Players: 1, 3, 4
    elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player4cardName1 = dealtCards[3]
        player4cardName2 = dealtCards[7]
        turn = 52 -- Player 4: 2nd Card (Split H1)
    -- Players: 1, 4, 5
    elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player4cardName1 = dealtCards[2]
        player4cardName2 = dealtCards[6]
        turn = 32 -- Player 4: 2nd Card (Split H1)
    -- Players: 2, 3, 4
    elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player4cardName1 = dealtCards[3]
        player4cardName2 = dealtCards[7]
        turn = 52 -- Player 4: 2nd Card (Split H1)
    -- Players: 2, 4, 5
    elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player4cardName1 = dealtCards[2]
        player4cardName2 = dealtCards[6]
        turn = 32 -- Player 4: 2nd Card (Split H1)
    -- Players: 3, 4, 5
    elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
        drawnCards[2]:Hide()
        drawnCards[6]:Hide()
        player4cardName1 = dealtCards[2]
        player4cardName2 = dealtCards[6]
        turn = 32 -- Player 4: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4
    elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
        drawnCards[4]:Hide()
        drawnCards[9]:Hide()
        player4cardName1 = dealtCards[4]
        player4cardName2 = dealtCards[9]
        turn = 74 -- Player 4: 2nd Card (Split H1)
    -- Players: 1, 2, 4, 5
    elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[8]:Hide()
        player4cardName1 = dealtCards[3]
        player4cardName2 = dealtCards[8]
        turn = 54 -- Player 4: 2nd Card (Split H1)
    -- Players: 1, 3, 4, 5
    elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[8]:Hide()
        player4cardName1 = dealtCards[3]
        player4cardName2 = dealtCards[8]
        turn = 54 -- Player 4: 2nd Card (Split H1)
    -- Players: 2, 3, 4, 5
    elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[8]:Hide()
        player4cardName1 = dealtCards[3]
        player4cardName2 = dealtCards[8]
        turn = 54 -- Player 4: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4, 5
    elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[4]:Hide()
        drawnCards[10]:Hide()
        player4cardName1 = dealtCards[4]
        player4cardName2 = dealtCards[10]
        turn = 76 -- Player 4: 2nd Card (Split H1)
    end

    player4cardImageFile1 = nil
    player4cardImageFile2 = nil

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player4cardName1 then
            player4cardImageFile1 = filename
            break
        end
    end

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player4cardName2 then
            player4cardImageFile2 = filename
            break
        end
    end

    player4NewCardImage1 = CreateFrame("Frame", nil, playerFrame)
    player4NewCardImage1:SetSize(32, 64)
    player4NewCardImage1:SetPoint("BOTTOM", playerFrame, -142, 325)
    player4NewCardImage1.texture = player4NewCardImage1:CreateTexture()
    player4NewCardImage1.texture:SetAllPoints()
    player4NewCardImage1.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4cardImageFile1)
    player4NewCardImage1:Show()

    player4NewCardImage2 = CreateFrame("Frame", nil, playerFrame)
    player4NewCardImage2:SetSize(32, 64)
    player4NewCardImage2:SetPoint("BOTTOM", playerFrame, -182, 345)
    player4NewCardImage2.texture = player4NewCardImage2:CreateTexture()
    player4NewCardImage2.texture:SetAllPoints()
    player4NewCardImage2.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4cardImageFile2)
    player4NewCardImage2:Show()

end

-- Player 4 Split Function
function player4HandleSplit(message)
    player4PlaceSplitBet()
    local player4MainBetAmountValue = tonumber(string.match(player4MainBetAmount:GetText(), "%d+"))
    if player4MainBetAmountValue then
        player4SplitHand1BetText(player4MainBetAmountValue)
    end 

    player4PlaceSplitCards()

    -- A,A
    if playerFrame.player4CardTotalText:GetText() == "2 or 12" then
        playerFrame.player4SplitHand1CardTotalText:SetText("1 or 11")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("1 or 11")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 2,2
    elseif playerFrame.player4CardTotalText:GetText() == "4" then
        playerFrame.player4SplitHand1CardTotalText:SetText("2")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("2")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 3,3
    elseif playerFrame.player4CardTotalText:GetText() == "6" then
        playerFrame.player4SplitHand1CardTotalText:SetText("3")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("3")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 4,4
    elseif playerFrame.player4CardTotalText:GetText() == "8" then
        playerFrame.player4SplitHand1CardTotalText:SetText("4")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("4")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 5,5
    elseif playerFrame.player4CardTotalText:GetText() == "10" then
        playerFrame.player4SplitHand1CardTotalText:SetText("5")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("5")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 6,6
    elseif playerFrame.player4CardTotalText:GetText() == "12" then
        playerFrame.player4SplitHand1CardTotalText:SetText("6")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("6")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 7,7
    elseif playerFrame.player4CardTotalText:GetText() == "14" then
        playerFrame.player4SplitHand1CardTotalText:SetText("7")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("7")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 8,8
    elseif playerFrame.player4CardTotalText:GetText() == "16" then
        playerFrame.player4SplitHand1CardTotalText:SetText("8")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("8")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 9,9
    elseif playerFrame.player4CardTotalText:GetText() == "18" then
        playerFrame.player4SplitHand1CardTotalText:SetText("9")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("9")
        playerFrame.player4SplitHand2CardTotalText:Show()
    -- 10,10
    elseif playerFrame.player4CardTotalText:GetText() == "20" then
        playerFrame.player4SplitHand1CardTotalText:SetText("10")
        playerFrame.player4SplitHand1CardTotalText:Show()
        playerFrame.player4SplitHand2CardTotalText:SetText("10")
        playerFrame.player4SplitHand2CardTotalText:Show()
    end

    playerFrame.player4CardTotalText:SetText("")
    playerFrame.player4CardTotalText:Hide()
    
    if playerName == unitName4 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player4totalBetAmount = player4totalBetAmount + tonumber(player4MainBetAmountValue)
            bankingInfo.totalWagered = player4totalBetAmount
            player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4MainBetAmountValue)
            bankingInfo.bankrollTable = player4TotalBankrollAmount
        end
    end

    historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")
    bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

    player4SplitToggle = true

    if player4dealtCardsFrame:IsShown() then
        player4dealtCardsFrame:Hide()
        player4dealtCardsFrame.playerCardsButton:Hide()
        player4dealtCardsFrameSplitH1:Show()
        player4dealtCardsFrameSplitH1.playerH1CardsButton:Show()
        player4dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    end

end

-- Function to handle Player 4 PP Bet Image
local function player4PlaceCoinsPPBet(message)
    playerFrame.player4PPBetCoins:Show()
end

-- Function to handle Player 4 PP Bet Text
local function player4PlaceTextPPBet(message)
    local player4HistoryPPBet = string.match(message, "(%d+)G")

        if player4HistoryPPBet then
            player4PPBetAmount:SetText(player4HistoryPPBet .. " G")
            player4PPBetAmount:Show()

            if playerName == unitName4 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName4]
                    player4totalBetAmount = player4totalBetAmount + tonumber(player4HistoryPPBet)
                    bankingInfo.totalWagered = player4totalBetAmount
                end
            end

            historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")

        else
    end
end

-- Function to handle Player 4 21+3 Bet Image
local function player4PlaceCoins213Bet(message)
    playerFrame.player4213BetCoins:Show()
end

-- Function to handle Player 4 21+3 Bet Text
local function player4PlaceText213Bet(message)
    local player4History213Bet = string.match(message, "(%d+)G")

        if player4History213Bet then
            player4213BetAmount:SetText(player4History213Bet .. " G")
            player4213BetAmount:Show()

            if playerName == unitName4 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName4]
                    player4totalBetAmount = player4totalBetAmount + tonumber(player4History213Bet)
                    bankingInfo.totalWagered = player4totalBetAmount
                end
            end

            historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")

        else
    end
end

local function player4PreloadBet()
    
    player4MainBet = tonumber(player4PreloadEditBoxMainBet:GetText()) or 0
    player4PPBet = tonumber(player4PreloadEditBoxPPBet:GetText()) or 0
    player4213Bet = tonumber(player4PreloadEditBox213Bet:GetText()) or 0

    player4TotalRebetAmount = player4MainBet + player4PPBet + player4213Bet

    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4currentBankroll - player4TotalRebetAmount < 0 then
        print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
    else
        local player4Threshold = minBetMain - 1
        if player4MainBet <= player4Threshold then
            print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
        else
            if player4MainBet and player4MainBet >= minBetMain and player4MainBet <= maxBetMain then
                PlaySoundFile(soundFilePaths[33])
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P4] Placing a " ..player4MainBet.. "G main bet.", "RAID")
                -- Disable the edit box and button
                player4PreloadEditBoxMainBet:SetFocus(false)
                player4PreloadEditBoxMainBet:ClearFocus()
                player4MainBetEditBox:SetText("")
                player4MainBetEditBox:SetText(player4MainBet)
                player4MainBetEditBox:SetFocus(false)
                player4MainBetEditBox:ClearFocus()
                player4MainBetEditBox:Disable()
                player4ConfirmMainBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4MainBet)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end
            end

            if player4PPBet and player4PPBet >= minBetPP and player4PPBet <= maxBetPP then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P4] Placing a " ..player4PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player4PreloadEditBoxPPBet:SetFocus(false)
                player4PreloadEditBoxPPBet:ClearFocus()
                player4PPBetEditBox:SetText("")
                player4PPBetEditBox:SetText(player4PPBet)
                player4PPBetEditBox:SetFocus(false)
                player4PPBetEditBox:ClearFocus()
                player4PPBetEditBox:Disable()
                player4ConfirmPPBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4PPBet)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end
            end

            if player4213Bet and player4213Bet >= minBet213 and player4213Bet <= maxBet213 then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P4] Placing a " ..player4213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player4PreloadEditBox213Bet:SetFocus(false)
                player4PreloadEditBox213Bet:ClearFocus()
                player4213BetEditBox:SetText("")
                player4213BetEditBox:SetText(player4213Bet)
                player4213BetEditBox:SetFocus(false)
                player4213BetEditBox:ClearFocus()
                player4213BetEditBox:Disable()
                player4Confirm213BetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4213Bet)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end
            end
            
            player4PreloadBetButton:Disable()

        end

        bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

    end

end

-- Function to handle the Player 1 Main "Bet" button click
local function player4ConfirmMainBetClick()
    player4MainBet = tonumber(player4MainBetEditBox:GetText())
    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4MainBet and player4MainBet >= minBetMain and player4MainBet <= maxBetMain then
        if player4currentBankroll - player4MainBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            -- Valid bet amount, send the message with the bet
            SendChatMessage("[P4] Placing a " ..player4MainBet.. "G main bet.", "RAID")
            -- Disable the edit box and button
            player4MainBetEditBox:SetFocus(false)
            player4MainBetEditBox:ClearFocus()
            player4MainBetEditBox:Disable()
            player4ConfirmMainBetButton:Disable()

            player4PreloadBetButton:Disable()

            PlaySoundFile(soundFilePaths[33]) 

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4MainBet)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetMain .. "G and " .. maxBetMain .. "G.")
    end

end

-- Function to handle the Player 1 PP "Bet" button click
local function player4ConfirmPPBetClick()
    player4PPBet = tonumber(player4PPBetEditBox:GetText()) -- Get the entered bet amount
    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4PPBet and player4PPBet >= minBetPP and player4PPBet <= maxBetPP then
        if player4currentBankroll - player4PPBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player4Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P4] Placing a " ..player4PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player4PPBetEditBox:SetFocus(false)
                player4PPBetEditBox:ClearFocus()
                player4PPBetEditBox:Disable()
                player4ConfirmPPBetButton:Disable()

                player4PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4PPBet)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end

                bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
                cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetPP .. "G and " .. maxBetPP .. "G.")
    end

end

-- Function to handle the Player 1 21+3 "Bet" button click
local function player4Confirm213BetClick()
    player4213Bet = tonumber(player4213BetEditBox:GetText()) -- Get the entered bet amount
    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4213Bet and player4213Bet >= minBet213 and player4213Bet <= maxBet213 then
        if player4currentBankroll - player4213Bet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player4Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P4] Placing a " ..player4213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player4213BetEditBox:SetFocus(false)
                player4213BetEditBox:ClearFocus()
                player4213BetEditBox:Disable()
                player4Confirm213BetButton:Disable()

                player4PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4213Bet)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end

                bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
                cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBet213 .. "G and " .. maxBet213 .. "G.")
    end
 
end

-- Player 4 Main "Bet" button
player4ConfirmMainBetButton:SetScript("OnClick", player4ConfirmMainBetClick)

-- Player 4 PP "Bet" button
player4ConfirmPPBetButton:SetScript("OnClick", player4ConfirmPPBetClick)

-- Player 4 21+3 "Bet" button
player4Confirm213BetButton:SetScript("OnClick", player4Confirm213BetClick)

-- Player 4 "Bet All" Preload button
player4PreloadBetButton:SetScript("OnClick", player4PreloadBet)

local function player4resetRaidChannel()
    if playerName == unitName4 then
        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/raid", chatFrame)
        
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:SetText("")
        editBox:Insert("/raid")
        
        ChatEdit_SendText(editBox)
        ChatEdit_DeactivateChat(editBox)
    else
        print("")
    end
end

player4HotstreakImage1 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage1:SetSize(36, 36)
player4HotstreakImage1:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak1.tga")
player4HotstreakImage1:SetDrawLayer("OVERLAY")
player4HotstreakImage1:Hide()

player4HotstreakImage2 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage2:SetSize(36, 36)
player4HotstreakImage2:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak2.tga")
player4HotstreakImage2:SetDrawLayer("OVERLAY")
player4HotstreakImage2:Hide()

player4HotstreakImage3 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage3:SetSize(36, 36)
player4HotstreakImage3:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak3.tga")
player4HotstreakImage3:SetDrawLayer("OVERLAY")
player4HotstreakImage3:Hide()

player4HotstreakImage4 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage4:SetSize(36, 36)
player4HotstreakImage4:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak4.tga")
player4HotstreakImage4:SetDrawLayer("OVERLAY")
player4HotstreakImage4:Hide()

player4HotstreakImage5 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage5:SetSize(36, 36)
player4HotstreakImage5:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak5.tga")
player4HotstreakImage5:SetDrawLayer("OVERLAY")
player4HotstreakImage5:Hide()

player4HotstreakImage6 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage6:SetSize(36, 36)
player4HotstreakImage6:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak6.tga")
player4HotstreakImage6:SetDrawLayer("OVERLAY")
player4HotstreakImage6:Hide()

player4HotstreakImage7 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage7:SetSize(36, 36)
player4HotstreakImage7:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak7.tga")
player4HotstreakImage7:SetDrawLayer("OVERLAY")
player4HotstreakImage7:Hide()

player4HotstreakImage8 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage8:SetSize(36, 36)
player4HotstreakImage8:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage8:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak8.tga")
player4HotstreakImage8:SetDrawLayer("OVERLAY")
player4HotstreakImage8:Hide()

player4HotstreakImage9 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage9:SetSize(36, 36)
player4HotstreakImage9:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage9:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak9.tga")
player4HotstreakImage9:SetDrawLayer("OVERLAY")
player4HotstreakImage9:Hide()

player4HotstreakImage10 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage10:SetSize(36, 36)
player4HotstreakImage10:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage10:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak10.tga")
player4HotstreakImage10:SetDrawLayer("OVERLAY")
player4HotstreakImage10:Hide()

player4HotstreakImage11 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage11:SetSize(36, 36)
player4HotstreakImage11:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage11:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak11.tga")
player4HotstreakImage11:SetDrawLayer("OVERLAY")
player4HotstreakImage11:Hide()

player4HotstreakImage12 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage12:SetSize(36, 36)
player4HotstreakImage12:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage12:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak12.tga")
player4HotstreakImage12:SetDrawLayer("OVERLAY")
player4HotstreakImage12:Hide()

player4HotstreakImage13 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage13:SetSize(36, 36)
player4HotstreakImage13:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage13:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak13.tga")
player4HotstreakImage13:SetDrawLayer("OVERLAY")
player4HotstreakImage13:Hide()

player4HotstreakImage14 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage14:SetSize(36, 36)
player4HotstreakImage14:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage14:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak14.tga")
player4HotstreakImage14:SetDrawLayer("OVERLAY")
player4HotstreakImage14:Hide()

player4HotstreakImage15 = playerFrame:CreateTexture(nil, "OVERLAY")
player4HotstreakImage15:SetSize(36, 36)
player4HotstreakImage15:SetPoint("CENTER", playerFrame, -339, -223)
player4HotstreakImage15:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak15.tga")
player4HotstreakImage15:SetDrawLayer("OVERLAY")
player4HotstreakImage15:Hide()

local function player4HotStreakCheck()
    if player4Hotstreak == 0 then
        player4HotstreakImage1:Hide()
        player4HotstreakImage2:Hide()
        player4HotstreakImage3:Hide()
        player4HotstreakImage4:Hide()
        player4HotstreakImage5:Hide()
        player4HotstreakImage6:Hide()
        player4HotstreakImage7:Hide()
        player4HotstreakImage8:Hide()
        player4HotstreakImage9:Hide()
        player4HotstreakImage10:Hide()
        player4HotstreakImage11:Hide()
        player4HotstreakImage12:Hide()
        player4HotstreakImage13:Hide()
        player4HotstreakImage14:Hide()
        player4HotstreakImage15:Hide()
    elseif player4Hotstreak == 1 then
        player4HotstreakImage1:Show()
    elseif player4Hotstreak == 2 then
        player4HotstreakImage1:Hide()
        player4HotstreakImage2:Show()
    elseif player4Hotstreak == 3 then
        player4HotstreakImage1:Hide()
        player4HotstreakImage2:Hide()
        player4HotstreakImage3:Show()
    elseif player4Hotstreak == 4 then
        player4HotstreakImage2:Hide()
        player4HotstreakImage3:Hide()
        player4HotstreakImage4:Show()
    elseif player4Hotstreak == 5 then
        player4HotstreakImage3:Hide()
        player4HotstreakImage4:Hide()
        player4HotstreakImage5:Show()
    elseif player4Hotstreak == 6 then
        player4HotstreakImage4:Hide()
        player4HotstreakImage5:Hide()
        player4HotstreakImage6:Show()
    elseif player4Hotstreak == 7 then
        player4HotstreakImage5:Hide()
        player4HotstreakImage6:Hide()
        player4HotstreakImage7:Show()
    elseif player4Hotstreak == 8 then
        player4HotstreakImage6:Hide()
        player4HotstreakImage7:Hide()
        player4HotstreakImage8:Show()
    elseif player4Hotstreak == 9 then
        player4HotstreakImage7:Hide()
        player4HotstreakImage8:Hide()
        player4HotstreakImage9:Show()
    elseif player4Hotstreak == 10 then
        player4HotstreakImage8:Hide()
        player4HotstreakImage9:Hide()
        player4HotstreakImage10:Show()
    elseif player4Hotstreak == 11 then
        player4HotstreakImage9:Hide()
        player4HotstreakImage10:Hide()
        player4HotstreakImage11:Show()
    elseif player4Hotstreak == 12 then
        player4HotstreakImage10:Hide()
        player4HotstreakImage11:Hide()
        player4HotstreakImage12:Show()
    elseif player4Hotstreak == 13 then
        player4HotstreakImage11:Hide()
        player4HotstreakImage12:Hide()
        player4HotstreakImage13:Show()
    elseif player4Hotstreak == 14 then
        player4HotstreakImage12:Hide()
        player4HotstreakImage13:Hide()
        player4HotstreakImage14:Show()
    elseif player4Hotstreak == 15 then
        player4HotstreakImage13:Hide()
        player4HotstreakImage14:Hide()
        player4HotstreakImage15:Show()
    end
end

-- Function to handle Player 4 PP Win Image
function player4PlaceBetsPPWin(message)
    playerFrame.player4PPBetCoins:Hide()
    playerFrame.player4PPWinCoins:Show()
    player4PPBetAmount:SetPoint("CENTER", playerFrame, -219, 43)
end

-- Function to handle Player 4 21+3 Win Image
function player4PlaceBets213Win(message)
    playerFrame.player4213BetCoins:Hide()
    playerFrame.player4213WinCoins:Show()
    player4213BetAmount:SetPoint("CENTER", playerFrame, -107, -8)
end

function player4MixedPairWin(message)

    if playerName == unitName4 then
        player4PPBetAmountValue = tonumber(string.match(player4PPBetEditBox:GetText(), "%d+"))
        if player4PPBetAmountValue then
            player4NewPPAmount = player4PPBetAmountValue * mixedPairPayoutReturn
            player4PPBetAmount:SetText(player4NewPPAmount .. " G")
            player4PPBetAmount:SetTextColor(0, 1, 0)

            player4PPProfitvalue = player4NewPPAmount - player4PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4totalWin = player4totalWin + tonumber(player4PPProfitvalue)
                    bankingInfo.totalWon = player4totalWin
                    player4totalProfit = player4totalProfit + tonumber(player4PPProfitvalue)
                    bankingInfo.totalProfit = player4totalProfit
                    player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4NewPPAmount)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4PPBetAmountValue = tonumber(string.match(player4PPBetAmount:GetText(), "%d+"))
        if player4PPBetAmountValue then
            player4NewPPAmount = player4PPBetAmountValue * mixedPairPayoutReturn
            player4PPBetAmount:SetText(player4NewPPAmount .. " G")
            player4PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBetsPPWin()
    player4PPSideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4NewPPAmount)

end

function player4ColouredPairWin(message)

    if playerName == unitName4 then
        player4PPBetAmountValue = tonumber(string.match(player4PPBetEditBox:GetText(), "%d+"))
        if player4PPBetAmountValue then
            player4NewPPAmount = player4PPBetAmountValue * colouredPairPayoutReturn
            player4PPBetAmount:SetText(player4NewPPAmount .. " G")
            player4PPBetAmount:SetTextColor(0, 1, 0)

            player4PPProfitvalue = player4NewPPAmount - player4PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4totalWin = player4totalWin + tonumber(player4PPProfitvalue)
                    bankingInfo.totalWon = player4totalWin
                    player4totalProfit = player4totalProfit + tonumber(player4PPProfitvalue)
                    bankingInfo.totalProfit = player4totalProfit
                    player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4NewPPAmount)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4PPBetAmountValue = tonumber(string.match(player4PPBetAmount:GetText(), "%d+"))
        if player4PPBetAmountValue then
            player4NewPPAmount = player4PPBetAmountValue * colouredPairPayoutReturn
            player4PPBetAmount:SetText(player4NewPPAmount .. " G")
            player4PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBetsPPWin()
    player4PPSideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4NewPPAmount)

end

function player4PerfectPairWin(message)

    if playerName == unitName4 then
        player4PPBetAmountValue = tonumber(string.match(player4PPBetEditBox:GetText(), "%d+"))
        if player4PPBetAmountValue then
            player4NewPPAmount = player4PPBetAmountValue * perfectPairPayoutReturn
            player4PPBetAmount:SetText(player4NewPPAmount .. " G")
            player4PPBetAmount:SetTextColor(0, 1, 0)

            player4PPProfitvalue = player4NewPPAmount - player4PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4totalWin = player4totalWin + tonumber(player4PPProfitvalue)
                    bankingInfo.totalWon = player4totalWin
                    player4totalProfit = player4totalProfit + tonumber(player4PPProfitvalue)
                    bankingInfo.totalProfit = player4totalProfit
                    player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4NewPPAmount)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4PPBetAmountValue = tonumber(string.match(player4PPBetAmount:GetText(), "%d+"))
        if player4PPBetAmountValue then
            player4NewPPAmount = player4PPBetAmountValue * perfectPairPayoutReturn
            player4PPBetAmount:SetText(player4NewPPAmount .. " G")
            player4PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBetsPPWin()
    player4PPSideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4NewPPAmount)

end

function player4SuitedThreeOfAKindWin(message)

    if playerName == unitName4 then
        player4213BetAmountValue = tonumber(string.match(player4213BetEditBox:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)

            player4213Profitvalue = player4New213Amount - player4213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalWin = player4totalWin + tonumber(player4213Profitvalue)
                bankingInfo.totalWon = player4totalWin
                player4totalProfit = player4totalProfit + tonumber(player4213Profitvalue)
                bankingInfo.totalProfit = player4totalProfit
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4New213Amount)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4213BetAmountValue = tonumber(string.match(player4213BetAmount:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBets213Win()
    player4213SideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4New213Amount)

end

function player4StraightFlushWin(message)
    
    if playerName == unitName4 then
        player4213BetAmountValue = tonumber(string.match(player4213BetEditBox:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * straightFlushPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)

            player4213Profitvalue = player4New213Amount - player4213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalWin = player4totalWin + tonumber(player4213Profitvalue)
                bankingInfo.totalWon = player4totalWin
                player4totalProfit = player4totalProfit + tonumber(player4213Profitvalue)
                bankingInfo.totalProfit = player4totalProfit
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4New213Amount)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4213BetAmountValue = tonumber(string.match(player4213BetAmount:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * straightFlushPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBets213Win()
    player4213SideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4New213Amount)

end

function player4ThreeOfAKindWin(message)

    if playerName == unitName4 then
        player4213BetAmountValue = tonumber(string.match(player4213BetEditBox:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * threeOfAKindPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)

            player4213Profitvalue = player4New213Amount - player4213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalWin = player4totalWin + tonumber(player4213Profitvalue)
                bankingInfo.totalWon = player4totalWin
                player4totalProfit = player4totalProfit + tonumber(player4213Profitvalue)
                bankingInfo.totalProfit = player4totalProfit
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4New213Amount)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4213BetAmountValue = tonumber(string.match(player4213BetAmount:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * threeOfAKindPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBets213Win()
    player4213SideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4New213Amount)

end

function player4StraightWin(message)

    if playerName == unitName4 then
        player4213BetAmountValue = tonumber(string.match(player4213BetEditBox:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * straightPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)

            player4213Profitvalue = player4New213Amount - player4213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalWin = player4totalWin + tonumber(player4213Profitvalue)
                bankingInfo.totalWon = player4totalWin
                player4totalProfit = player4totalProfit + tonumber(player4213Profitvalue)
                bankingInfo.totalProfit = player4totalProfit
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4New213Amount)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4213BetAmountValue = tonumber(string.match(player4213BetAmount:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * straightPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBets213Win()
    player4213SideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4New213Amount)

end

function player4FlushWin(message)

    if playerName == unitName4 then
        player4213BetAmountValue = tonumber(string.match(player4213BetEditBox:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * flushPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)

            player4213Profitvalue = player4New213Amount - player4213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalWin = player4totalWin + tonumber(player4213Profitvalue)
                bankingInfo.totalWon = player4totalWin
                player4totalProfit = player4totalProfit + tonumber(player4213Profitvalue)
                bankingInfo.totalProfit = player4totalProfit
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4New213Amount)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end

            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        end
    else
        player4213BetAmountValue = tonumber(string.match(player4213BetAmount:GetText(), "%d+"))
        if player4213BetAmountValue then
            player4New213Amount = player4213BetAmountValue * flushPayoutReturn
            player4213BetAmount:SetText(player4New213Amount .. " G")
            player4213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player4PlaceBets213Win()
    player4213SideBetWin = true

    player4SessionWin = player4SessionWin + tonumber(player4New213Amount)

end

function player4Loss()
    player4MainBetValue = tonumber(string.match(player4MainBetAmount:GetText(), "%d+"))
    if player4MainBetValue then
        
        if playerName == unitName4 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalLoss = player4totalLoss + tonumber(player4MainBetValue)
                bankingInfo.totalLost = player4totalLoss
                player4totalProfit = player4totalProfit - tonumber(player4MainBetValue)
                bankingInfo.totalProfit = player4totalProfit
            end
        end

        if player4totalProfit >= 0 then
            historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
        historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")

        local player4PPBetText = player4PPBetAmount:GetText()

        if player4PPBetText and player4PPBetText ~= "" then
            player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
            
            if player4PPBetAmountValue then
                if player4PPSideBetWin == false then

                    player4PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")

                end
            end
        end

        local player4213BetText = player4213BetAmount:GetText()

        if player4213BetText and player4213BetText ~= "" then
            player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

            if player4213BetAmountValue then
                if player4213SideBetWin == false then

                    player4213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")

                end
            end
        end
    end
end

function player4SplitH1Loss()
    player4SplitHand1BetAmountValue = tonumber(string.match(player4SplitH1BetAmount:GetText(), "%d+"))
    if player4SplitHand1BetAmountValue then

        if playerName == unitName4 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalLoss = player4totalLoss + tonumber(player4SplitHand1BetAmountValue)
                bankingInfo.totalLost = player4totalLoss
                player4totalProfit = player4totalProfit - tonumber(player4SplitHand1BetAmountValue)
                bankingInfo.totalProfit = player4totalProfit
            end
        end

        historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
        historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")

        if player4totalProfit >= 0 then
            historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

    end
end

function player4SplitH2Loss()
    player4SplitHand2BetAmountValue = tonumber(string.match(player4SplitH2BetAmount:GetText(), "%d+"))
    if player4SplitHand2BetAmountValue then

        if playerName == unitName4 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalLoss = player4totalLoss + tonumber(player4SplitHand2BetAmountValue)
                bankingInfo.totalLost = player4totalLoss
                player4totalProfit = player4totalProfit - tonumber(player4SplitHand2BetAmountValue)
                bankingInfo.totalProfit = player4totalProfit
            end
        end

        historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
        historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")

        if player4totalProfit >= 0 then
            historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        local player4PPBetText = player4PPBetAmount:GetText()

        if player4PPBetText and player4PPBetText ~= "" then
            player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
            
            if player4PPBetAmountValue then
                if player4PPSideBetWin == false then

                    player4PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player4213BetText = player4213BetAmount:GetText()

        if player4213BetText and player4213BetText ~= "" then
            player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

            if player4213BetAmountValue then
                if player4213SideBetWin == false then

                    player4213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end
end

function player4Push()
    player4MainBetValue = tonumber(string.match(player4MainBetAmount:GetText(), "%d+"))
    if player4MainBetValue then


        if playerName == unitName4 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4MainBetValue)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end
        end

        bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

        local player4PPBetText = player4PPBetAmount:GetText()

        if player4PPBetText and player4PPBetText ~= "" then
            player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
            
            if player4PPBetAmountValue then
                if player4PPSideBetWin == false then

                    player4PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player4213BetText = player4213BetAmount:GetText()

        if player4213BetText and player4213BetText ~= "" then
            player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

            if player4213BetAmountValue then
                if player4213SideBetWin == false then

                    player4213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        player4SessionWin = player4SessionWin + tonumber(player4MainBetValue)

    end
end

function player4SplitH1Push()
    player4SplitHand1BetAmountValue = tonumber(string.match(player4SplitH1BetAmount:GetText(), "%d+"))
    if player4SplitHand1BetAmountValue then

        if playerName == unitName4 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4SplitHand1BetAmountValue)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end
        end

        bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    
        player4SessionWin = player4SessionWin + tonumber(player4SplitHand1BetAmountValue)
    
    end
end

function player4SplitH2Push()
    player4SplitHand2BetAmountValue = tonumber(string.match(player4SplitH2BetAmount:GetText(), "%d+"))
    if player4SplitHand2BetAmountValue then

        if playerName == unitName4 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4SplitHand2BetAmountValue)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end
        end

        bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

        local player4PPBetText = player4PPBetAmount:GetText()

        if player4PPBetText and player4PPBetText ~= "" then
            player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
            
            if player4PPBetAmountValue then
                if player4PPSideBetWin == false then

                    player4PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player4213BetText = player4213BetAmount:GetText()

        if player4213BetText and player4213BetText ~= "" then
            player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

            if player4213BetAmountValue then
                if player4213SideBetWin == false then

                    player4213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    
        player4SessionWin = player4SessionWin + tonumber(player4SplitHand2BetAmountValue)
    
    end
end

function player4BJWin(message)
    player4MainBetAmountValue = tonumber(string.match(player4MainBetAmount:GetText(), "%d+"))
    if player4MainBetAmountValue then
        player4BJWinAmountValue = player4MainBetAmountValue * 2.5
        player4MainBetAmount:SetText(player4BJWinAmountValue .. " G")
    end

    player4BJProfitvalue = player4BJWinAmountValue - player4MainBetAmountValue

    if playerName == unitName4 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player4totalWin = player4totalWin + tonumber(player4BJProfitvalue)
            bankingInfo.totalWon = player4totalWin
            player4totalProfit = player4totalProfit + tonumber(player4BJProfitvalue)
            bankingInfo.totalProfit = player4totalProfit
            player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4BJWinAmountValue)
            bankingInfo.bankrollTable = player4TotalBankrollAmount
        end
    end

    if player4totalProfit >= 0 then
        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
    bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

    local player4PPBetText = player4PPBetAmount:GetText()

    if player4PPBetText and player4PPBetText ~= "" then
        player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
        
        if player4PPBetAmountValue then
            if player4PPSideBetWin == false then

                player4PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName4 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                        bankingInfo.totalLost = player4totalLoss
                        player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                        bankingInfo.totalProfit = player4totalProfit
                    end
                end
        
                historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
        
                if player4totalProfit >= 0 then
                    historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player4213BetText = player4213BetAmount:GetText()

    if player4213BetText and player4213BetText ~= "" then
        player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

        if player4213BetAmountValue then
            if player4213SideBetWin == false then

                player4213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName4 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                        bankingInfo.totalLost = player4totalLoss
                        player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                        bankingInfo.totalProfit = player4totalProfit
                    end
                end
        
                historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
        
                if player4totalProfit >= 0 then
                    historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player4MainBetCoins:Hide()
    playerFrame.player4BJWinCoins:Show()

    player4SessionWin = player4SessionWin + tonumber(player4BJWinAmountValue)

end

function player4SplitH1BJ(message)
    player4SplitHand1BetAmountValue = tonumber(string.match(player4SplitH1BetAmount:GetText(), "%d+"))
    if player4SplitHand1BetAmountValue then
        player4SplitHand1BJWinAmountValue = player4SplitHand1BetAmountValue * 2.5
        player4SplitH1BetAmount:SetText(player4SplitHand1BJWinAmountValue .. " G")
    end

    player4SplitHand1BJProfitValue = player4SplitHand1BJWinAmountValue - player4SplitHand1BetAmountValue

    if playerName == unitName4 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player4totalWin = player4totalWin + tonumber(player4SplitHand1BJProfitValue)
            bankingInfo.totalWon = player4totalWin
            player4totalProfit = player4totalProfit + tonumber(player4SplitHand1BJProfitValue)
            bankingInfo.totalProfit = player4totalProfit
            player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4SplitHand1BJWinAmountValue)
            bankingInfo.bankrollTable = player4TotalBankrollAmount
        end
    end

    if player4totalProfit >= 0 then
        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
    bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

    playerFrame.player4SplitHand1Coins:Hide()
    playerFrame.player4SplitHand1BJWinCoins:Show()

    player4SessionWin = player4SessionWin + tonumber(player4SplitHand1BJWinAmountValue)

end

function player4SplitH2BJ(message)
    player4SplitHand2BetAmountValue = tonumber(string.match(player4SplitH2BetAmount:GetText(), "%d+"))
    if player4SplitHand2BetAmountValue then
        player4SplitHand2BJWinAmountValue = player4SplitHand2BetAmountValue * 2.5
        player4SplitH2BetAmount:SetText(player4SplitHand2BJWinAmountValue .. " G")
    end

    player4SplitHand2BJProfitValue = player4SplitHand2BJWinAmountValue - player4SplitHand2BetAmountValue

    if playerName == unitName4 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player4totalWin = player4totalWin + tonumber(player4SplitHand2BJProfitValue)
            bankingInfo.totalWon = player4totalWin
            player4totalProfit = player4totalProfit + tonumber(player4SplitHand2BJProfitValue)
            bankingInfo.totalProfit = player4totalProfit
            player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4SplitHand2BJWinAmountValue)
            bankingInfo.bankrollTable = player4TotalBankrollAmount
        end
    end

    if player4totalProfit >= 0 then
        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
    bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

    local player4PPBetText = player4PPBetAmount:GetText()

    if player4PPBetText and player4PPBetText ~= "" then
        player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
        
        if player4PPBetAmountValue then
            if player4PPSideBetWin == false then

                player4PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName4 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                        bankingInfo.totalLost = player4totalLoss
                        player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                        bankingInfo.totalProfit = player4totalProfit
                    end
                end
        
                historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
        
                if player4totalProfit >= 0 then
                    historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player4213BetText = player4213BetAmount:GetText()

    if player4213BetText and player4213BetText ~= "" then
        player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

        if player4213BetAmountValue then
            if player4213SideBetWin == false then

                player4213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName4 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                        bankingInfo.totalLost = player4totalLoss
                        player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                        bankingInfo.totalProfit = player4totalProfit
                    end
                end
        
                historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
        
                if player4totalProfit >= 0 then
                    historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player4SplitHand2Coins:Hide()
    playerFrame.player4SplitHand2BJWinCoins:Show()

    player4SessionWin = player4SessionWin + tonumber(player4SplitHand2BJWinAmountValue)

end

function player4Win(message)
    player4MainBetAmountValue = tonumber(string.match(player4MainBetAmount:GetText(), "%d+"))
    if player4MainBetAmountValue then
        player4NormalWinAmountValue = player4MainBetAmountValue * 2
        player4MainBetAmount:SetText(player4NormalWinAmountValue .. " G")

        if playerName == unitName4 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player4totalWin = player4totalWin + tonumber(player4MainBetAmountValue)
                bankingInfo.totalWon = player4totalWin
                player4totalProfit = player4totalProfit + tonumber(player4MainBetAmountValue)
                bankingInfo.totalProfit = player4totalProfit
                player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4NormalWinAmountValue)
                bankingInfo.bankrollTable = player4TotalBankrollAmount
            end
        end
    
        if player4totalProfit >= 0 then
            historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end
    
        historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
        historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
        bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

        local player4PPBetText = player4PPBetAmount:GetText()

        if player4PPBetText and player4PPBetText ~= "" then
            player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
            
            if player4PPBetAmountValue then
                if player4PPSideBetWin == false then

                    player4PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player4213BetText = player4213BetAmount:GetText()

        if player4213BetText and player4213BetText ~= "" then
            player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

            if player4213BetAmountValue then
                if player4213SideBetWin == false then

                    player4213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName4 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                            bankingInfo.totalLost = player4totalLoss
                            player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                            bankingInfo.totalProfit = player4totalProfit
                        end
                    end
            
                    historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            
                    if player4totalProfit >= 0 then
                        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end

    playerFrame.player4MainBetCoins:Hide()
    playerFrame.player4NormalWinCoins:Show()

    player4SessionWin = player4SessionWin + tonumber(player4NormalWinAmountValue)

end

function player4SplitH1Win(message)
    player4SplitHand1BetAmountValue = tonumber(string.match(player4SplitH1BetAmount:GetText(), "%d+"))
    if player4SplitHand1BetAmountValue then
        player4SplitHand1NormalWinAmountValue = player4SplitHand1BetAmountValue * 2
        player4SplitH1BetAmount:SetText(player4SplitHand1NormalWinAmountValue .. " G")
    end

    if playerName == unitName4 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player4totalWin = player4totalWin + tonumber(player4SplitHand1BetAmountValue)
            bankingInfo.totalWon = player4totalWin
            player4totalProfit = player4totalProfit + tonumber(player4SplitHand1BetAmountValue)
            bankingInfo.totalProfit = player4totalProfit
            player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4SplitHand1NormalWinAmountValue)
            bankingInfo.bankrollTable = player4TotalBankrollAmount
        end
    end

    if player4totalProfit >= 0 then
        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
    bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

    playerFrame.player4SplitHand1Coins:Hide()
    playerFrame.player4SplitHand1NormalWinCoins:Show()

    player4SessionWin = player4SessionWin + tonumber(player4SplitHand1NormalWinAmountValue)

end

function player4SplitH2Win(message)
    player4SplitHand2BetAmountValue = tonumber(string.match(player4SplitH2BetAmount:GetText(), "%d+"))
    if player4SplitHand2BetAmountValue then
        player4SplitHand2NormalWinAmountValue = player4SplitHand2BetAmountValue * 2
        player4SplitH2BetAmount:SetText(player4SplitHand2NormalWinAmountValue .. " G")
    end

    if playerName == unitName4 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player4totalWin = player4totalWin + tonumber(player4SplitHand2BetAmountValue)
            bankingInfo.totalWon = player4totalWin
            player4totalProfit = player4totalProfit + tonumber(player4SplitHand2BetAmountValue)
            bankingInfo.totalProfit = player4totalProfit
            player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4SplitHand2NormalWinAmountValue)
            bankingInfo.bankrollTable = player4TotalBankrollAmount
        end
    end

    if player4totalProfit >= 0 then
        historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
    historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
    bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

    local player4PPBetText = player4PPBetAmount:GetText()

    if player4PPBetText and player4PPBetText ~= "" then
        player4PPBetAmountValue = tonumber(string.match(player4PPBetText, "%d+"))
        
        if player4PPBetAmountValue then
            if player4PPSideBetWin == false then

                player4PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName4 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player4totalLoss = player4totalLoss + tonumber(player4PPBetAmountValue)
                        bankingInfo.totalLost = player4totalLoss
                        player4totalProfit = player4totalProfit - tonumber(player4PPBetAmountValue)
                        bankingInfo.totalProfit = player4totalProfit
                    end
                end
        
                historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
        
                if player4totalProfit >= 0 then
                    historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player4213BetText = player4213BetAmount:GetText()

    if player4213BetText and player4213BetText ~= "" then
        player4213BetAmountValue = tonumber(string.match(player4213BetText, "%d+"))

        if player4213BetAmountValue then
            if player4213SideBetWin == false then

                player4213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName4 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player4totalLoss = player4totalLoss + tonumber(player4213BetAmountValue)
                        bankingInfo.totalLost = player4totalLoss
                        player4totalProfit = player4totalProfit - tonumber(player4213BetAmountValue)
                        bankingInfo.totalProfit = player4totalProfit
                    end
                end
        
                historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
                historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
        
                if player4totalProfit >= 0 then
                    historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player4SplitHand2Coins:Hide()
    playerFrame.player4SplitHand2NormalWinCoins:Show()

    player4SessionWin = player4SessionWin + tonumber(player4SplitHand2NormalWinAmountValue)

end

function player4InsuranceWin(message)

    local player4InsuranceBetText = playerFrame.player4InsuranceBetAmount:GetText()

    if player4InsuranceBetText and player4InsuranceBetText ~= "" then
        player4InsuranceBetAmountValue = tonumber(string.match(player4InsuranceBetText, "%d+"))

        if player4InsuranceBetAmountValue then
            player4InsuranceWinAmountValue = player4InsuranceBetAmountValue * 3

            player4InsuranceProfitValue = player4InsuranceWinAmountValue - player4InsuranceBetAmountValue


            if playerName == unitName4 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4totalWin = player4totalWin + tonumber(player4InsuranceProfitValue)
                    bankingInfo.totalWon = player4totalWin
                    player4totalProfit = player4totalProfit + tonumber(player4InsuranceProfitValue)
                    bankingInfo.totalProfit = player4totalProfit
                    player4TotalBankrollAmount = player4TotalBankrollAmount + tonumber(player4InsuranceWinAmountValue)
                    bankingInfo.bankrollTable = player4TotalBankrollAmount
                end
            end
        
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
        
            historyFrame.player4totalWonAmount:SetText(player4totalWin .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")
            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")

            player4SessionWin = player4SessionWin + tonumber(player4InsuranceWinAmountValue)

        end
    end
end

function player4InsuranceLoss(message)

    local player4InsuranceBetText = playerFrame.player4InsuranceBetAmount:GetText()

    if player4InsuranceBetText and player4InsuranceBetText ~= "" then
        player4InsuranceBetAmountValue = tonumber(string.match(player4InsuranceBetText, "%d+"))

        if player4InsuranceBetAmountValue then

            if playerName == unitName4 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player4totalLoss = player4totalLoss + tonumber(player4InsuranceBetAmountValue)
                    bankingInfo.totalLost = player4totalLoss
                    player4totalProfit = player4totalProfit - tonumber(player4InsuranceBetAmountValue)
                    bankingInfo.totalProfit = player4totalProfit
                end
            end
    
            if player4totalProfit >= 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
    
            historyFrame.player4totalLostAmount:SetText(player4totalLoss .. " G")
            historyFrame.player4ProfitAmount:SetText(player4totalProfit .. " G")

        end
    end
end

local function player4SessionWinAnnouncement()
    if playerName == unitName4 then
        if player4SessionWinCalled == false then
            if player4SessionWin >= 2 then
                local chatFrame = SELECTED_DOCK_FRAME
                ChatFrame_OpenChat("/me", chatFrame)
                
                local editBox = _G[chatFrame:GetName().."EditBox"]
                editBox:SetText("")
                editBox:Insert("/me has won " .. player4SessionWin .. "g from a hand of Blackjack.")
                
                ChatEdit_SendText(editBox)
                ChatEdit_DeactivateChat(editBox)

                UpdateWinningsDisplay(playerFrame.player4WinningsUpdate, player4SessionWin)
                player4resetRaidChannel()
                
            else
                print("")
            end

            player4SessionWinCalled = true
        end
    end
end

















-- >>> PLAYER 5 <<<
-- >>> PLAYER 5 <<<
-- >>> PLAYER 5 <<<

playerFrame.player5CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", -385, 368)
playerFrame.player5CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 28, "OUTLINE") -- Adjust the font and size as needed
playerFrame.player5CardTotalText:SetText("")

playerFrame.player5SplitHand1CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5SplitHand1CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", -370, 355)
playerFrame.player5SplitHand1CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player5SplitHand1CardTotalText:SetText("")

playerFrame.player5SplitHand2CardTotalText = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5SplitHand2CardTotalText:SetPoint("BOTTOM", playerFrame, "BOTTOM", -400, 395)
playerFrame.player5SplitHand2CardTotalText:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
playerFrame.player5SplitHand2CardTotalText:SetText("")

-- Buttons for Player 5
-- Hit
playerFrame.player5HitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5HitButton:SetPoint("BOTTOM", playerFrame, -472, 275)
playerFrame.player5HitButton:SetSize(65, 30)
playerFrame.player5HitButton:SetText("Hit")
playerFrame.player5HitButton:Disable()
playerFrame.player5HitButton:Hide()
-- Stand
playerFrame.player5StandButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5StandButton:SetPoint("BOTTOM", playerFrame, -406, 275)
playerFrame.player5StandButton:SetSize(65, 30)
playerFrame.player5StandButton:SetText("Stand")
playerFrame.player5StandButton:Disable()
playerFrame.player5StandButton:Hide()
-- Double
playerFrame.player5DoubleButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5DoubleButton:SetPoint("BOTTOM", playerFrame, -472, 245)
playerFrame.player5DoubleButton:SetSize(65, 30)
playerFrame.player5DoubleButton:SetText("Double")
playerFrame.player5DoubleButton:Disable()
playerFrame.player5DoubleButton:Hide()
-- Split
playerFrame.player5SplitButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5SplitButton:SetPoint("BOTTOM", playerFrame, -406, 245)
playerFrame.player5SplitButton:SetSize(65, 30)
playerFrame.player5SplitButton:SetText("Split")
playerFrame.player5SplitButton:Disable()
playerFrame.player5SplitButton:Hide()
-- Insurance Yes
playerFrame.player5InsuranceYesButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5InsuranceYesButton:SetPoint("BOTTOM", playerFrame, -505, 215)
playerFrame.player5InsuranceYesButton:SetSize(55, 30)
playerFrame.player5InsuranceYesButton:SetText("Yes")
playerFrame.player5InsuranceYesButton:Disable()
playerFrame.player5InsuranceYesButton:Hide()
-- Insurance No
playerFrame.player5InsuranceNoButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5InsuranceNoButton:SetPoint("BOTTOM", playerFrame, -378, 215)
playerFrame.player5InsuranceNoButton:SetSize(55, 30)
playerFrame.player5InsuranceNoButton:SetText("No")
playerFrame.player5InsuranceNoButton:Disable()
playerFrame.player5InsuranceNoButton:Hide()
-- Deal Now
playerFrame.player5DealNowButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5DealNowButton:SetPoint("BOTTOM", playerFrame, -439, 215)
playerFrame.player5DealNowButton:SetSize(85, 30)
playerFrame.player5DealNowButton:SetText("Deal Now")
playerFrame.player5DealNowButton:Disable()
playerFrame.player5DealNowButton:Hide()
-- Hit (Split H1)
playerFrame.player5HitButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5HitButtonSplitH1:SetPoint("BOTTOM", playerFrame, -406, 275)
playerFrame.player5HitButtonSplitH1:SetSize(65, 30)
playerFrame.player5HitButtonSplitH1:SetText("Hit")
playerFrame.player5HitButtonSplitH1:Disable()
playerFrame.player5HitButtonSplitH1:Hide()
-- Stand (Split H1)
playerFrame.player5StandButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5StandButtonSplitH1:SetPoint("BOTTOM", playerFrame, -406, 245)
playerFrame.player5StandButtonSplitH1:SetSize(65, 30)
playerFrame.player5StandButtonSplitH1:SetText("Stand")
playerFrame.player5StandButtonSplitH1:Disable()
playerFrame.player5StandButtonSplitH1:Hide()
-- Double (Split H1)
playerFrame.player5DoubleButtonSplitH1 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5DoubleButtonSplitH1:SetPoint("BOTTOM", playerFrame, -406, 215)
playerFrame.player5DoubleButtonSplitH1:SetSize(65, 30)
playerFrame.player5DoubleButtonSplitH1:SetText("Double")
playerFrame.player5DoubleButtonSplitH1:Disable()
playerFrame.player5DoubleButtonSplitH1:Hide()
-- Hit (Split H2)
playerFrame.player5HitButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5HitButtonSplitH2:SetPoint("BOTTOM", playerFrame, -472, 275)
playerFrame.player5HitButtonSplitH2:SetSize(65, 30)
playerFrame.player5HitButtonSplitH2:SetText("Hit")
playerFrame.player5HitButtonSplitH2:Disable()
playerFrame.player5HitButtonSplitH2:Hide()
-- Stand (Split H2)
playerFrame.player5StandButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5StandButtonSplitH2:SetPoint("BOTTOM", playerFrame, -472, 245)
playerFrame.player5StandButtonSplitH2:SetSize(65, 30)
playerFrame.player5StandButtonSplitH2:SetText("Stand")
playerFrame.player5StandButtonSplitH2:Disable()
playerFrame.player5StandButtonSplitH2:Hide()
-- Double (Split H2)
playerFrame.player5DoubleButtonSplitH2 = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
playerFrame.player5DoubleButtonSplitH2:SetPoint("BOTTOM", playerFrame, -472, 215)
playerFrame.player5DoubleButtonSplitH2:SetSize(65, 30)
playerFrame.player5DoubleButtonSplitH2:SetText("Double")
playerFrame.player5DoubleButtonSplitH2:Disable()
playerFrame.player5DoubleButtonSplitH2:Hide()
-- Main Bet Confirm
player5ConfirmMainBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player5ConfirmMainBetButton:SetPoint("BOTTOM", playerFrame, -406, 334)
player5ConfirmMainBetButton:SetSize(65, 30)
player5ConfirmMainBetButton:SetText("Bet")
player5ConfirmMainBetButton:Hide()
-- Perfect Pairs Confirm
player5ConfirmPPBetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player5ConfirmPPBetButton:SetPoint("BOTTOM", playerFrame, -375, 468)
player5ConfirmPPBetButton:SetSize(43, 25)
player5ConfirmPPBetButton:SetText("Bet")
player5ConfirmPPBetButton:Hide()
-- 21+3 Confirm
player5Confirm213BetButton = CreateFrame("Button", nil, playerFrame, "GameMenuButtonTemplate")
player5Confirm213BetButton:SetPoint("BOTTOM", playerFrame, -305, 335)
player5Confirm213BetButton:SetSize(43, 25)
player5Confirm213BetButton:SetText("Bet")
player5Confirm213BetButton:Hide()

-- Wagers for Player 5
-- Main Bet
player5MainBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player5MainBetEditBox:SetSize(55, 30)
player5MainBetEditBox:SetPoint("BOTTOM", playerFrame, -468, 334)
player5MainBetEditBox:SetAutoFocus(false)
player5MainBetEditBox:SetNumeric(true)
player5MainBetEditBox:Hide()
-- Split Hand 1
player5SplitH1EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player5SplitH1EditBox:SetSize(55, 30)
player5SplitH1EditBox:SetPoint("BOTTOM", playerFrame, -403, 334)
player5SplitH1EditBox:SetAutoFocus(false)
player5SplitH1EditBox:SetNumeric(true)
player5SplitH1EditBox:ClearFocus()
player5SplitH1EditBox:Disable()
player5SplitH1EditBox:Hide()
-- Split Hand 2
player5SplitH2EditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player5SplitH2EditBox:SetSize(55, 30)
player5SplitH2EditBox:SetPoint("BOTTOM", playerFrame, -468, 334)
player5SplitH2EditBox:SetAutoFocus(false)
player5SplitH2EditBox:SetNumeric(true)
player5SplitH2EditBox:ClearFocus()
player5SplitH2EditBox:Disable()
player5SplitH2EditBox:Hide()
-- Perfect Pairs
player5PPBetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player5PPBetEditBox:SetSize(35, 30)
player5PPBetEditBox:SetPoint("BOTTOM", playerFrame, -373, 488)
player5PPBetEditBox:SetAutoFocus(false)
player5PPBetEditBox:SetNumeric(true)
player5PPBetEditBox:Hide()
-- 21+3
player5213BetEditBox = CreateFrame("EditBox", nil, playerFrame, "InputBoxTemplate")
player5213BetEditBox:SetSize(35, 30)
player5213BetEditBox:SetPoint("BOTTOM", playerFrame, -303, 355)
player5213BetEditBox:SetAutoFocus(false)
player5213BetEditBox:SetNumeric(true)
player5213BetEditBox:Hide()

-- Labels for Player 5
-- Main Bet
playerFrame.player5MainBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5MainBetTitle:SetPoint("BOTTOM", playerFrame, -468, 362)
playerFrame.player5MainBetTitle:SetJustifyH("CENTER")
playerFrame.player5MainBetTitle:SetText("Main Bet")
playerFrame.player5MainBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player5MainBetTitle:Hide()
-- Split Hand 1
playerFrame.player5SplitH1Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5SplitH1Title:SetPoint("BOTTOM", playerFrame, -403, 362)
playerFrame.player5SplitH1Title:SetJustifyH("CENTER")
playerFrame.player5SplitH1Title:SetText("Hand 1")
playerFrame.player5SplitH1Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player5SplitH1Title:Hide()
-- Split Hand 2
playerFrame.player5SplitH2Title = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5SplitH2Title:SetPoint("BOTTOM", playerFrame, -468, 362)
playerFrame.player5SplitH2Title:SetJustifyH("CENTER")
playerFrame.player5SplitH2Title:SetText("Hand 2")
playerFrame.player5SplitH2Title:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player5SplitH2Title:Hide()
-- Main Bet Amount
player5MainBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5MainBetAmount:SetPoint("CENTER", playerFrame, -330, 97)
player5MainBetAmount:SetJustifyH("CENTER")
player5MainBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 1 Amount
player5SplitH1BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5SplitH1BetAmount:SetPoint("CENTER", playerFrame, -312, 103)
player5SplitH1BetAmount:SetJustifyH("CENTER")
player5SplitH1BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Split Hand 2 Amount
player5SplitH2BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5SplitH2BetAmount:SetPoint("CENTER", playerFrame, -347, 103)
player5SplitH2BetAmount:SetJustifyH("CENTER")
player5SplitH2BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Perfect Pairs
playerFrame.player5PPBetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5PPBetTitle:SetPoint("BOTTOM", playerFrame, -408, 483)
playerFrame.player5PPBetTitle:SetJustifyH("CENTER")
playerFrame.player5PPBetTitle:SetText("PP")
playerFrame.player5PPBetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player5PPBetTitle:Hide()
-- Perfect Pairs Amount
player5PPBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5PPBetAmount:SetPoint("CENTER", playerFrame, -328, 154)
player5PPBetAmount:SetJustifyH("CENTER")
player5PPBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- 21+3
playerFrame.player5213BetTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5213BetTitle:SetPoint("BOTTOM", playerFrame, -261, 351)
playerFrame.player5213BetTitle:SetJustifyH("CENTER")
playerFrame.player5213BetTitle:SetText("21+3")
playerFrame.player5213BetTitle:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE")
playerFrame.player5213BetTitle:Hide()
-- 21+3 Amount
player5213BetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
player5213BetAmount:SetPoint("CENTER", playerFrame, -263, 56)
player5213BetAmount:SetJustifyH("CENTER")
player5213BetAmount:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
-- Insurance Amount
playerFrame.player5InsuranceBetAmount = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5InsuranceBetAmount:SetPoint("CENTER", playerFrame, -332, -110)
playerFrame.player5InsuranceBetAmount:SetJustifyH("CENTER")
playerFrame.player5InsuranceBetAmount:SetFont("Fonts\\FRIZQT__.TTF", 9, "OUTLINE")
-- Player Name
playerFrame.player5Name = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5Name:SetPoint("BOTTOM", playerFrame, -439, 310)
playerFrame.player5Name:SetText("Seat Empty")
playerFrame.player5Name:SetFont("Fonts\\FRIZQT__.TTF", 22, "OUTLINE")
-- Insurance
playerFrame.player5InsuranceTitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5InsuranceTitle:SetPoint("BOTTOM", playerFrame, -439, 228)
playerFrame.player5InsuranceTitle:SetText("Insurance")
playerFrame.player5InsuranceTitle:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
playerFrame.player5InsuranceTitle:Hide()
-- Insurance (if available)
playerFrame.player5InsuranceSubtitle = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5InsuranceSubtitle:SetPoint("BOTTOM", playerFrame, -439, 218)
playerFrame.player5InsuranceSubtitle:SetText("(if available)")
playerFrame.player5InsuranceSubtitle:SetFont("Fonts\\FRIZQT__.TTF", 8, "OUTLINE")
playerFrame.player5InsuranceSubtitle:Hide()
-- Session Win Update
playerFrame.player5WinningsUpdate = playerFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
playerFrame.player5WinningsUpdate:SetPoint("BOTTOMLEFT", playerFrame, 270, 30) 
playerFrame.player5WinningsUpdate:SetText("")
playerFrame.player5WinningsUpdate:SetFont("Fonts\\FRIZQT__.TTF", 16, "OUTLINE")
playerFrame.player5WinningsUpdate:SetTextColor(0.118, 0.839, 0.412)

-- Images for Player 5
-- Turn Arrow
playerFrame.player5TurnArrow = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5TurnArrow:SetSize(128, 128)
playerFrame.player5TurnArrow:SetPoint("CENTER", playerFrame, -330, -20)
playerFrame.player5TurnArrow:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\TurnArrow.tga")
playerFrame.player5TurnArrow:SetBlendMode("BLEND")
playerFrame.player5TurnArrow:SetDrawLayer("OVERLAY")
playerFrame.player5TurnArrow:Hide()
-- Main Bet
playerFrame.player5MainBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5MainBetCoins:SetSize(128, 128)
playerFrame.player5MainBetCoins:SetPoint("CENTER", playerFrame, -308, 68)
playerFrame.player5MainBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player5MainBetCoins:SetBlendMode("BLEND")
playerFrame.player5MainBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player5MainBetCoins:Hide()
-- Win
playerFrame.player5NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5NormalWinCoins:SetSize(128, 128)
playerFrame.player5NormalWinCoins:SetPoint("CENTER", playerFrame, -308, 68)
playerFrame.player5NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player5NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player5NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5NormalWinCoins:Hide()
-- Split Hand 2 Bet
playerFrame.player5SplitHand2Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand2Coins:SetSize(128, 128)
playerFrame.player5SplitHand2Coins:SetPoint("CENTER", playerFrame, -322, 83)
playerFrame.player5SplitHand2Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player5SplitHand2Coins:SetBlendMode("BLEND")
playerFrame.player5SplitHand2Coins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand2Coins:Hide()
-- Split Double Hand 2 Bet
playerFrame.player5SplitHand2DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand2DoubleCoins:SetSize(128, 128)
playerFrame.player5SplitHand2DoubleCoins:SetPoint("CENTER", playerFrame, -322, 83)
playerFrame.player5SplitHand2DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player5SplitHand2DoubleCoins:SetBlendMode("BLEND")
playerFrame.player5SplitHand2DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand2DoubleCoins:Hide()
-- Split Win Hand 2
playerFrame.player5SplitHand2NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand2NormalWinCoins:SetSize(128, 128)
playerFrame.player5SplitHand2NormalWinCoins:SetPoint("CENTER", playerFrame, -322, 83)
playerFrame.player5SplitHand2NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player5SplitHand2NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player5SplitHand2NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand2NormalWinCoins:Hide()
-- Split Hand 1 Bet
playerFrame.player5SplitHand1Coins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand1Coins:SetSize(128, 128)
playerFrame.player5SplitHand1Coins:SetPoint("CENTER", playerFrame, -295, 58)
playerFrame.player5SplitHand1Coins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player5SplitHand1Coins:SetBlendMode("BLEND")
playerFrame.player5SplitHand1Coins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand1Coins:Hide()
-- Split Double Hand 1 Bet
playerFrame.player5SplitHand1DoubleCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand1DoubleCoins:SetSize(128, 128)
playerFrame.player5SplitHand1DoubleCoins:SetPoint("CENTER", playerFrame, -295, 58)
playerFrame.player5SplitHand1DoubleCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player5SplitHand1DoubleCoins:SetBlendMode("BLEND")
playerFrame.player5SplitHand1DoubleCoins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand1DoubleCoins:Hide()
-- Split Win Hand 1
playerFrame.player5SplitHand1NormalWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand1NormalWinCoins:SetSize(128, 128)
playerFrame.player5SplitHand1NormalWinCoins:SetPoint("CENTER", playerFrame, -295, 58)
playerFrame.player5SplitHand1NormalWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player5SplitHand1NormalWinCoins:SetBlendMode("BLEND")
playerFrame.player5SplitHand1NormalWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand1NormalWinCoins:Hide()
-- Blackjack Win
playerFrame.player5BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5BJWinCoins:SetSize(128, 128)
playerFrame.player5BJWinCoins:SetPoint("CENTER", playerFrame, -308, 68)
playerFrame.player5BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player5BJWinCoins:SetBlendMode("BLEND")
playerFrame.player5BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5BJWinCoins:Hide()
-- Split BJ Win Hand 2
playerFrame.player5SplitHand2BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand2BJWinCoins:SetSize(128, 128)
playerFrame.player5SplitHand2BJWinCoins:SetPoint("CENTER", playerFrame, -322, 83)
playerFrame.player5SplitHand2BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player5SplitHand2BJWinCoins:SetBlendMode("BLEND")
playerFrame.player5SplitHand2BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand2BJWinCoins:Hide()
-- Split BJ Win Hand 1
playerFrame.player5SplitHand1BJWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5SplitHand1BJWinCoins:SetSize(128, 128)
playerFrame.player5SplitHand1BJWinCoins:SetPoint("CENTER", playerFrame, -295, 58)
playerFrame.player5SplitHand1BJWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBJWin.tga")
playerFrame.player5SplitHand1BJWinCoins:SetBlendMode("BLEND")
playerFrame.player5SplitHand1BJWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5SplitHand1BJWinCoins:Hide()
-- Double Bet
playerFrame.player5DoubleBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5DoubleBetCoins:SetSize(128, 128)
playerFrame.player5DoubleBetCoins:SetPoint("CENTER", playerFrame, -308, 68)
playerFrame.player5DoubleBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsWin.tga")
playerFrame.player5DoubleBetCoins:SetBlendMode("BLEND")
playerFrame.player5DoubleBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player5DoubleBetCoins:Hide()
-- PP Bet
playerFrame.player5PPBetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5PPBetCoins:SetSize(128, 128)
playerFrame.player5PPBetCoins:SetPoint("CENTER", playerFrame, -323, 136)
playerFrame.player5PPBetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player5PPBetCoins:SetBlendMode("BLEND")
playerFrame.player5PPBetCoins:SetDrawLayer("OVERLAY")
playerFrame.player5PPBetCoins:Hide()
-- 21+3 Bet
playerFrame.player5213BetCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5213BetCoins:SetSize(128, 128)
playerFrame.player5213BetCoins:SetPoint("CENTER", playerFrame, -258, 36)
playerFrame.player5213BetCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsHalfBet.tga")
playerFrame.player5213BetCoins:SetBlendMode("BLEND")
playerFrame.player5213BetCoins:SetDrawLayer("OVERLAY")
playerFrame.player5213BetCoins:Hide()
-- PP Win
playerFrame.player5PPWinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5PPWinCoins:SetSize(128, 128)
playerFrame.player5PPWinCoins:SetPoint("CENTER", playerFrame, -311, 140)
playerFrame.player5PPWinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player5PPWinCoins:SetBlendMode("BLEND")
playerFrame.player5PPWinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5PPWinCoins:Hide()
-- 21+3 Win
playerFrame.player5213WinCoins = playerFrame:CreateTexture(nil, "OVERLAY")
playerFrame.player5213WinCoins:SetSize(128, 128)
playerFrame.player5213WinCoins:SetPoint("CENTER", playerFrame, -247, 41)
playerFrame.player5213WinCoins:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\CoinsBet.tga")
playerFrame.player5213WinCoins:SetBlendMode("BLEND")
playerFrame.player5213WinCoins:SetDrawLayer("OVERLAY")
playerFrame.player5213WinCoins:Hide()
-- Insurance YES for Player 5
player5InsuranceYesIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player5InsuranceYesIcon:SetSize(24, 24)
player5InsuranceYesIcon:SetPoint("CENTER", playerFrame, -336, -130)
player5InsuranceYesIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceYes.tga")
player5InsuranceYesIcon:SetDrawLayer("OVERLAY")
player5InsuranceYesIcon:Hide()
-- Insurance NO for Player 5
player5InsuranceNoIcon = playerFrame:CreateTexture(nil, "OVERLAY")
player5InsuranceNoIcon:SetSize(24, 24)
player5InsuranceNoIcon:SetPoint("CENTER", playerFrame, -336, -130)
player5InsuranceNoIcon:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\insuranceNo.tga")
player5InsuranceNoIcon:SetDrawLayer("OVERLAY")
player5InsuranceNoIcon:Hide()

-- BJ Win Coins
local function player5PlaceCoinsBJWin(message)
    playerFrame.player5MainBetCoins:Hide()
    playerFrame.player5BJWinCoins:Show()
end

-- Regular Win Coins
local function player5PlaceCoinsRegularWin(message)
    playerFrame.player5MainBetCoins:Hide()
    playerFrame.player5DoubleBetCoins:Show()
end

-- Main Bet Coins
local function player5PlaceCoinsMainBet(message)
    playerFrame.player5MainBetCoins:Show()
end

-- Double Bet Coins
local function player5PlaceCoinsDoubleBet(message)
    playerFrame.player5MainBetCoins:Hide()
    playerFrame.player5DoubleBetCoins:Show()
end

-- Function to handle Player 5 Main Bet Text
local function player5PlaceTextMainBet(message)
    local player5HistoryMainBet = string.match(message, "(%d+)G")

        if player5HistoryMainBet then
            player5MainBetAmount:SetText(player5HistoryMainBet .. " G")
            player5MainBetAmount:Show()

            if playerName == unitName5 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName5]
                    player5totalBetAmount = player5totalBetAmount + tonumber(player5HistoryMainBet)
                    bankingInfo.totalWagered = player5totalBetAmount
                end
            end

            historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")

        else
    end
end

-- Player 5 Split Hand Bet Text
function player5SplitHand1BetText(Amount)
    player5MainBetAmount:Hide()
    player5MainBetAmount:SetText("")
    player5SplitH1BetAmount:SetText(Amount .. " G")
    player5SplitH1BetAmount:Show()
    player5SplitH2BetAmount:SetText(Amount .. " G")
    player5SplitH2BetAmount:Show()
end

-- Player 5 Split Bet Image
function player5PlaceSplitBet(message)
    playerFrame.player5MainBetCoins:Hide()
    playerFrame.player5SplitHand1Coins:Show()
    playerFrame.player5SplitHand2Coins:Show()
end

-- Player 5 Place Initial Card Images
function player5PlaceSplitCards(message)

    -- Players: 5
    if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
        drawnCards[1]:Hide()
        drawnCards[3]:Hide()
        player5cardName1 = dealtCards[1]
        player5cardName2 = dealtCards[3]
        turn = 8 -- Player 5: 2nd Card (Split H1)

    -- Players: 1, 5
    elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player5cardName1 = dealtCards[2]
        player5cardName2 = dealtCards[5]
        turn = 30 -- Player 5: 2nd Card (Split H1)
    -- Players: 2, 5
    elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player5cardName1 = dealtCards[2]
        player5cardName2 = dealtCards[5]
        turn = 30 -- Player 5: 2nd Card (Split H1)
    -- Players: 3, 5
    elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player5cardName1 = dealtCards[2]
        player5cardName2 = dealtCards[5]
        turn = 30 -- Player 5: 2nd Card (Split H1)
    -- Players: 4, 5
    elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
        drawnCards[2]:Hide()
        drawnCards[5]:Hide()
        player5cardName1 = dealtCards[2]
        player5cardName2 = dealtCards[5]
        turn = 30 -- Player 5: 2nd Card (Split H1)

    -- Players: 1, 2, 5
    elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player5cardName1 = dealtCards[3]
        player5cardName2 = dealtCards[7]
        turn = 52 -- Player 5: 2nd Card (Split H1)
    -- Players: 1, 3, 5
    elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player5cardName1 = dealtCards[3]
        player5cardName2 = dealtCards[7]
        turn = 52 -- Player 5: 2nd Card (Split H1)
    -- Players: 1, 4, 5
    elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player5cardName1 = dealtCards[3]
        player5cardName2 = dealtCards[7]
        turn = 52 -- Player 5: 2nd Card (Split H1)
    -- Players: 2, 3, 5
    elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player5cardName1 = dealtCards[3]
        player5cardName2 = dealtCards[7]
        turn = 52 -- Player 5: 2nd Card (Split H1)
    -- Players: 2, 4, 5
    elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player5cardName1 = dealtCards[3]
        player5cardName2 = dealtCards[7]
        turn = 52 -- Player 5: 2nd Card (Split H1)
    -- Players: 3, 4, 5
    elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
        drawnCards[3]:Hide()
        drawnCards[7]:Hide()
        player5cardName1 = dealtCards[3]
        player5cardName2 = dealtCards[7]
        turn = 52 -- Player 5: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 5
    elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
        drawnCards[4]:Hide()
        drawnCards[9]:Hide()
        player5cardName1 = dealtCards[4]
        player5cardName2 = dealtCards[9]
        turn = 74 -- Player 5: 2nd Card (Split H1)
    -- Players: 1, 2, 4, 5
    elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
        drawnCards[4]:Hide()
        drawnCards[9]:Hide()
        player5cardName1 = dealtCards[4]
        player5cardName2 = dealtCards[9]
        turn = 74 -- Player 5: 2nd Card (Split H1)
    -- Players: 1, 3, 4, 5
    elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
        drawnCards[4]:Hide()
        drawnCards[9]:Hide()
        player5cardName1 = dealtCards[4]
        player5cardName2 = dealtCards[9]
        turn = 74 -- Player 5: 2nd Card (Split H1)
    -- Players: 2, 3, 4, 5
    elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[4]:Hide()
        drawnCards[9]:Hide()
        player5cardName1 = dealtCards[4]
        player5cardName2 = dealtCards[9]
        turn = 74 -- Player 5: 2nd Card (Split H1)

    -- Players: 1, 2, 3, 4, 5
    elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
        drawnCards[5]:Hide()
        drawnCards[11]:Hide()
        player5cardName1 = dealtCards[5]
        player5cardName2 = dealtCards[11]
        turn = 96 -- Player 5: 2nd Card (Split H1)
    end

    player5cardImageFile1 = nil
    player5cardImageFile2 = nil

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player5cardName1 then
            player5cardImageFile1 = filename
            break
        end
    end

    for filename, cardDescription in pairs(cardNames) do
        if cardDescription == player5cardName2 then
            player5cardImageFile2 = filename
            break
        end
    end

    player5NewCardImage1 = CreateFrame("Frame", nil, playerFrame)
    player5NewCardImage1:SetSize(32, 64)
    player5NewCardImage1:SetPoint("BOTTOM", playerFrame, -253, 435)
    player5NewCardImage1.texture = player5NewCardImage1:CreateTexture()
    player5NewCardImage1.texture:SetAllPoints()
    player5NewCardImage1.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5cardImageFile1)
    player5NewCardImage1:Show()

    player5NewCardImage2 = CreateFrame("Frame", nil, playerFrame)
    player5NewCardImage2:SetSize(32, 64)
    player5NewCardImage2:SetPoint("BOTTOM", playerFrame, -290, 454)
    player5NewCardImage2.texture = player5NewCardImage2:CreateTexture()
    player5NewCardImage2.texture:SetAllPoints()
    player5NewCardImage2.texture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5cardImageFile2)
    player5NewCardImage2:Show()

end

-- Player 5 Split Function
function player5HandleSplit(message)
    player5PlaceSplitBet()
    local player5MainBetAmountValue = tonumber(string.match(player5MainBetAmount:GetText(), "%d+"))
    if player5MainBetAmountValue then
        player5SplitHand1BetText(player5MainBetAmountValue)
    end 

    player5PlaceSplitCards()

    -- A,A
    if playerFrame.player5CardTotalText:GetText() == "2 or 12" then
        playerFrame.player5SplitHand1CardTotalText:SetText("1 or 11")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("1 or 11")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 2,2
    elseif playerFrame.player5CardTotalText:GetText() == "4" then
        playerFrame.player5SplitHand1CardTotalText:SetText("2")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("2")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 3,3
    elseif playerFrame.player5CardTotalText:GetText() == "6" then
        playerFrame.player5SplitHand1CardTotalText:SetText("3")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("3")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 4,4
    elseif playerFrame.player5CardTotalText:GetText() == "8" then
        playerFrame.player5SplitHand1CardTotalText:SetText("4")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("4")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 5,5
    elseif playerFrame.player5CardTotalText:GetText() == "10" then
        playerFrame.player5SplitHand1CardTotalText:SetText("5")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("5")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 6,6
    elseif playerFrame.player5CardTotalText:GetText() == "12" then
        playerFrame.player5SplitHand1CardTotalText:SetText("6")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("6")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 7,7
    elseif playerFrame.player5CardTotalText:GetText() == "14" then
        playerFrame.player5SplitHand1CardTotalText:SetText("7")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("7")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 8,8
    elseif playerFrame.player5CardTotalText:GetText() == "16" then
        playerFrame.player5SplitHand1CardTotalText:SetText("8")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("8")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 9,9
    elseif playerFrame.player5CardTotalText:GetText() == "18" then
        playerFrame.player5SplitHand1CardTotalText:SetText("9")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("9")
        playerFrame.player5SplitHand2CardTotalText:Show()
    -- 10,10
    elseif playerFrame.player5CardTotalText:GetText() == "20" then
        playerFrame.player5SplitHand1CardTotalText:SetText("10")
        playerFrame.player5SplitHand1CardTotalText:Show()
        playerFrame.player5SplitHand2CardTotalText:SetText("10")
        playerFrame.player5SplitHand2CardTotalText:Show()
    end

    playerFrame.player5CardTotalText:SetText("")
    playerFrame.player5CardTotalText:Hide()
    
    if playerName == unitName5 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player5totalBetAmount = player5totalBetAmount + tonumber(player5MainBetAmountValue)
            bankingInfo.totalWagered = player5totalBetAmount
            player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5MainBetAmountValue)
            bankingInfo.bankrollTable = player5TotalBankrollAmount
        end
    end

    historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")
    bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

    player5SplitToggle = true

    if player5dealtCardsFrame:IsShown() then
        player5dealtCardsFrame:Hide()
        player5dealtCardsFrame.playerCardsButton:Hide()
        player5dealtCardsFrameSplitH1:Show()
        player5dealtCardsFrameSplitH1.playerH1CardsButton:Show()
        player5dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    end

end

-- Function to handle Player 5 PP Bet Image
local function player5PlaceCoinsPPBet(message)
    playerFrame.player5PPBetCoins:Show()
end

-- Function to handle Player 5 PP Bet Text
local function player5PlaceTextPPBet(message)
    local player5HistoryPPBet = string.match(message, "(%d+)G")

        if player5HistoryPPBet then
            player5PPBetAmount:SetText(player5HistoryPPBet .. " G")
            player5PPBetAmount:Show()

            if playerName == unitName5 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName5]
                    player5totalBetAmount = player5totalBetAmount + tonumber(player5HistoryPPBet)
                    bankingInfo.totalWagered = player5totalBetAmount
                end
            end

            historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")

        else
    end
end

-- Function to handle Player 5 21+3 Bet Image
local function player5PlaceCoins213Bet(message)
    playerFrame.player5213BetCoins:Show()
end

-- Function to handle Player 5 21+3 Bet Text
local function player5PlaceText213Bet(message)
    local player5History213Bet = string.match(message, "(%d+)G")

        if player5History213Bet then
            player5213BetAmount:SetText(player5History213Bet .. " G")
            player5213BetAmount:Show()

            if playerName == unitName5 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[unitName5]
                    player5totalBetAmount = player5totalBetAmount + tonumber(player5History213Bet)
                    bankingInfo.totalWagered = player5totalBetAmount
                end
            end

            historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")

        else
    end
end

local function player5PreloadBet()
    
    player5MainBet = tonumber(player5PreloadEditBoxMainBet:GetText()) or 0
    player5PPBet = tonumber(player5PreloadEditBoxPPBet:GetText()) or 0
    player5213Bet = tonumber(player5PreloadEditBox213Bet:GetText()) or 0

    player5TotalRebetAmount = player5MainBet + player5PPBet + player5213Bet

    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5currentBankroll - player5TotalRebetAmount < 0 then
        print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
    else
        local player5Threshold = minBetMain - 1
        if player5MainBet <= player5Threshold then
            print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
        else
            if player5MainBet and player5MainBet >= minBetMain and player5MainBet <= maxBetMain then
                PlaySoundFile(soundFilePaths[33])
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P5] Placing a " ..player5MainBet.. "G main bet.", "RAID")
                -- Disable the edit box and button
                player5PreloadEditBoxMainBet:SetFocus(false)
                player5PreloadEditBoxMainBet:ClearFocus()
                player5MainBetEditBox:SetText("")
                player5MainBetEditBox:SetText(player5MainBet)
                player5MainBetEditBox:SetFocus(false)
                player5MainBetEditBox:ClearFocus()
                player5MainBetEditBox:Disable()
                player5ConfirmMainBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5MainBet)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end
            end

            if player5PPBet and player5PPBet >= minBetPP and player5PPBet <= maxBetPP then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P5] Placing a " ..player5PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player5PreloadEditBoxPPBet:SetFocus(false)
                player5PreloadEditBoxPPBet:ClearFocus()
                player5PPBetEditBox:SetText("")
                player5PPBetEditBox:SetText(player5PPBet)
                player5PPBetEditBox:SetFocus(false)
                player5PPBetEditBox:ClearFocus()
                player5PPBetEditBox:Disable()
                player5ConfirmPPBetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5PPBet)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end
            end

            if player5213Bet and player5213Bet >= minBet213 and player5213Bet <= maxBet213 then
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P5] Placing a " ..player5213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player5PreloadEditBox213Bet:SetFocus(false)
                player5PreloadEditBox213Bet:ClearFocus()
                player5213BetEditBox:SetText("")
                player5213BetEditBox:SetText(player5213Bet)
                player5213BetEditBox:SetFocus(false)
                player5213BetEditBox:ClearFocus()
                player5213BetEditBox:Disable()
                player5Confirm213BetButton:Disable()

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5213Bet)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end
            end
            
            player5PreloadBetButton:Disable()

        end

        bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

    end

end

-- Function to handle the Player 1 Main "Bet" button click
local function player5ConfirmMainBetClick()
    player5MainBet = tonumber(player5MainBetEditBox:GetText())
    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5MainBet and player5MainBet >= minBetMain and player5MainBet <= maxBetMain then
        if player5currentBankroll - player5MainBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            -- Valid bet amount, send the message with the bet
            SendChatMessage("[P5] Placing a " ..player5MainBet.. "G main bet.", "RAID")
            -- Disable the edit box and button
            player5MainBetEditBox:SetFocus(false)
            player5MainBetEditBox:ClearFocus()
            player5MainBetEditBox:Disable()
            player5ConfirmMainBetButton:Disable()

            player5PreloadBetButton:Disable()

            PlaySoundFile(soundFilePaths[33]) 

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5MainBet)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetMain .. "G and " .. maxBetMain .. "G.")
    end

end

-- Function to handle the Player 1 PP "Bet" button click
local function player5ConfirmPPBetClick()
    player5PPBet = tonumber(player5PPBetEditBox:GetText()) -- Get the entered bet amount
    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5PPBet and player5PPBet >= minBetPP and player5PPBet <= maxBetPP then
        if player5currentBankroll - player5PPBet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player5Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P5] Placing a " ..player5PPBet.. "G side bet on Perfect Pairs.", "RAID")
                -- Disable the edit box and button
                player5PPBetEditBox:SetFocus(false)
                player5PPBetEditBox:ClearFocus()
                player5PPBetEditBox:Disable()
                player5ConfirmPPBetButton:Disable()

                player5PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5PPBet)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end

                bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
                cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBetPP .. "G and " .. maxBetPP .. "G.")
    end

end

-- Function to handle the Player 1 21+3 "Bet" button click
local function player5Confirm213BetClick()
    player5213Bet = tonumber(player5213BetEditBox:GetText()) -- Get the entered bet amount
    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5213Bet and player5213Bet >= minBet213 and player5213Bet <= maxBet213 then
        if player5currentBankroll - player5213Bet < 0 then
            print("You do not have enough gold in your bankroll to place that bet. Please visit the Cash Desk.")
        else
            if not player5Active then
                print("You must place a minimum 'Main Bet' of " .. minBetMain .. "G before placing this side bet")
            else
                -- Valid bet amount, send the message with the bet
                SendChatMessage("[P5] Placing a " ..player5213Bet.. "G side bet on 21+3.", "RAID")
                -- Disable the edit box and button
                player5213BetEditBox:SetFocus(false)
                player5213BetEditBox:ClearFocus()
                player5213BetEditBox:Disable()
                player5Confirm213BetButton:Disable()

                player5PreloadBetButton:Disable()

                PlaySoundFile(soundFilePaths[33])

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5213Bet)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end

                bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
                cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

            end
        end
    else
        print("Invalid bet amount. Please enter a value between " .. minBet213 .. "G and " .. maxBet213 .. "G.")
    end
 
end

-- Player 5 Main "Bet" button
player5ConfirmMainBetButton:SetScript("OnClick", player5ConfirmMainBetClick)

-- Player 5 PP "Bet" button
player5ConfirmPPBetButton:SetScript("OnClick", player5ConfirmPPBetClick)

-- Player 5 21+3 "Bet" button
player5Confirm213BetButton:SetScript("OnClick", player5Confirm213BetClick)

-- Player 5 "Bet All" Preload button
player5PreloadBetButton:SetScript("OnClick", player5PreloadBet)

local function player5resetRaidChannel()
    if playerName == unitName5 then
        local chatFrame = SELECTED_DOCK_FRAME
        ChatFrame_OpenChat("/raid", chatFrame)
        
        local editBox = _G[chatFrame:GetName().."EditBox"]
        editBox:SetText("")
        editBox:Insert("/raid")
        
        ChatEdit_SendText(editBox)
        ChatEdit_DeactivateChat(editBox)
    else
        print("")
    end
end

player5HotstreakImage1 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage1:SetSize(36, 36)
player5HotstreakImage1:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak1.tga")
player5HotstreakImage1:SetDrawLayer("OVERLAY")
player5HotstreakImage1:Hide()

player5HotstreakImage2 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage2:SetSize(36, 36)
player5HotstreakImage2:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak2.tga")
player5HotstreakImage2:SetDrawLayer("OVERLAY")
player5HotstreakImage2:Hide()

player5HotstreakImage3 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage3:SetSize(36, 36)
player5HotstreakImage3:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak3.tga")
player5HotstreakImage3:SetDrawLayer("OVERLAY")
player5HotstreakImage3:Hide()

player5HotstreakImage4 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage4:SetSize(36, 36)
player5HotstreakImage4:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak4.tga")
player5HotstreakImage4:SetDrawLayer("OVERLAY")
player5HotstreakImage4:Hide()

player5HotstreakImage5 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage5:SetSize(36, 36)
player5HotstreakImage5:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak5.tga")
player5HotstreakImage5:SetDrawLayer("OVERLAY")
player5HotstreakImage5:Hide()

player5HotstreakImage6 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage6:SetSize(36, 36)
player5HotstreakImage6:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak6.tga")
player5HotstreakImage6:SetDrawLayer("OVERLAY")
player5HotstreakImage6:Hide()

player5HotstreakImage7 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage7:SetSize(36, 36)
player5HotstreakImage7:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak7.tga")
player5HotstreakImage7:SetDrawLayer("OVERLAY")
player5HotstreakImage7:Hide()

player5HotstreakImage8 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage8:SetSize(36, 36)
player5HotstreakImage8:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage8:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak8.tga")
player5HotstreakImage8:SetDrawLayer("OVERLAY")
player5HotstreakImage8:Hide()

player5HotstreakImage9 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage9:SetSize(36, 36)
player5HotstreakImage9:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage9:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak9.tga")
player5HotstreakImage9:SetDrawLayer("OVERLAY")
player5HotstreakImage9:Hide()

player5HotstreakImage10 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage10:SetSize(36, 36)
player5HotstreakImage10:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage10:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak10.tga")
player5HotstreakImage10:SetDrawLayer("OVERLAY")
player5HotstreakImage10:Hide()

player5HotstreakImage11 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage11:SetSize(36, 36)
player5HotstreakImage11:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage11:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak11.tga")
player5HotstreakImage11:SetDrawLayer("OVERLAY")
player5HotstreakImage11:Hide()

player5HotstreakImage12 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage12:SetSize(36, 36)
player5HotstreakImage12:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage12:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak12.tga")
player5HotstreakImage12:SetDrawLayer("OVERLAY")
player5HotstreakImage12:Hide()

player5HotstreakImage13 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage13:SetSize(36, 36)
player5HotstreakImage13:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage13:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak13.tga")
player5HotstreakImage13:SetDrawLayer("OVERLAY")
player5HotstreakImage13:Hide()

player5HotstreakImage14 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage14:SetSize(36, 36)
player5HotstreakImage14:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage14:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak14.tga")
player5HotstreakImage14:SetDrawLayer("OVERLAY")
player5HotstreakImage14:Hide()

player5HotstreakImage15 = playerFrame:CreateTexture(nil, "OVERLAY")
player5HotstreakImage15:SetSize(36, 36)
player5HotstreakImage15:SetPoint("CENTER", playerFrame, -523, -82)
player5HotstreakImage15:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\Hotstreak15.tga")
player5HotstreakImage15:SetDrawLayer("OVERLAY")
player5HotstreakImage15:Hide()

local function player5HotStreakCheck()
    if player5Hotstreak == 0 then
        player5HotstreakImage1:Hide()
        player5HotstreakImage2:Hide()
        player5HotstreakImage3:Hide()
        player5HotstreakImage4:Hide()
        player5HotstreakImage5:Hide()
        player5HotstreakImage6:Hide()
        player5HotstreakImage7:Hide()
        player5HotstreakImage8:Hide()
        player5HotstreakImage9:Hide()
        player5HotstreakImage10:Hide()
        player5HotstreakImage11:Hide()
        player5HotstreakImage12:Hide()
        player5HotstreakImage13:Hide()
        player5HotstreakImage14:Hide()
        player5HotstreakImage15:Hide()
    elseif player5Hotstreak == 1 then
        player5HotstreakImage1:Show()
    elseif player5Hotstreak == 2 then
        player5HotstreakImage1:Hide()
        player5HotstreakImage2:Show()
    elseif player5Hotstreak == 3 then
        player5HotstreakImage1:Hide()
        player5HotstreakImage2:Hide()
        player5HotstreakImage3:Show()
    elseif player5Hotstreak == 4 then
        player5HotstreakImage2:Hide()
        player5HotstreakImage3:Hide()
        player5HotstreakImage4:Show()
    elseif player5Hotstreak == 5 then
        player5HotstreakImage3:Hide()
        player5HotstreakImage4:Hide()
        player5HotstreakImage5:Show()
    elseif player5Hotstreak == 6 then
        player5HotstreakImage4:Hide()
        player5HotstreakImage5:Hide()
        player5HotstreakImage6:Show()
    elseif player5Hotstreak == 7 then
        player5HotstreakImage5:Hide()
        player5HotstreakImage6:Hide()
        player5HotstreakImage7:Show()
    elseif player5Hotstreak == 8 then
        player5HotstreakImage6:Hide()
        player5HotstreakImage7:Hide()
        player5HotstreakImage8:Show()
    elseif player5Hotstreak == 9 then
        player5HotstreakImage7:Hide()
        player5HotstreakImage8:Hide()
        player5HotstreakImage9:Show()
    elseif player5Hotstreak == 10 then
        player5HotstreakImage8:Hide()
        player5HotstreakImage9:Hide()
        player5HotstreakImage10:Show()
    elseif player5Hotstreak == 11 then
        player5HotstreakImage9:Hide()
        player5HotstreakImage10:Hide()
        player5HotstreakImage11:Show()
    elseif player5Hotstreak == 12 then
        player5HotstreakImage10:Hide()
        player5HotstreakImage11:Hide()
        player5HotstreakImage12:Show()
    elseif player5Hotstreak == 13 then
        player5HotstreakImage11:Hide()
        player5HotstreakImage12:Hide()
        player5HotstreakImage13:Show()
    elseif player5Hotstreak == 14 then
        player5HotstreakImage12:Hide()
        player5HotstreakImage13:Hide()
        player5HotstreakImage14:Show()
    elseif player5Hotstreak == 15 then
        player5HotstreakImage13:Hide()
        player5HotstreakImage14:Hide()
        player5HotstreakImage15:Show()
    end
end

-- Function to handle Player 5 PP Win Image
function player5PlaceBetsPPWin(message)
    playerFrame.player5PPBetCoins:Hide()
    playerFrame.player5PPWinCoins:Show()
    player5PPBetAmount:SetPoint("CENTER", playerFrame, -328, 171)
end

-- Function to handle Player 5 21+3 Win Image
function player5PlaceBets213Win(message)
    playerFrame.player5213BetCoins:Hide()
    playerFrame.player5213WinCoins:Show()
    player5213BetAmount:SetPoint("CENTER", playerFrame, -263, 73)
end

function player5MixedPairWin(message)

    if playerName == unitName5 then
        player5PPBetAmountValue = tonumber(string.match(player5PPBetEditBox:GetText(), "%d+"))
        if player5PPBetAmountValue then
            player5NewPPAmount = player5PPBetAmountValue * mixedPairPayoutReturn
            player5PPBetAmount:SetText(player5NewPPAmount .. " G")
            player5PPBetAmount:SetTextColor(0, 1, 0)

            player5PPProfitvalue = player5NewPPAmount - player5PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5totalWin = player5totalWin + tonumber(player5PPProfitvalue)
                    bankingInfo.totalWon = player5totalWin
                    player5totalProfit = player5totalProfit + tonumber(player5PPProfitvalue)
                    bankingInfo.totalProfit = player5totalProfit
                    player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5NewPPAmount)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5PPBetAmountValue = tonumber(string.match(player5PPBetAmount:GetText(), "%d+"))
        if player5PPBetAmountValue then
            player5NewPPAmount = player5PPBetAmountValue * mixedPairPayoutReturn
            player5PPBetAmount:SetText(player5NewPPAmount .. " G")
            player5PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBetsPPWin()
    player5PPSideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5NewPPAmount)

end

function player5ColouredPairWin(message)

    if playerName == unitName5 then
        player5PPBetAmountValue = tonumber(string.match(player5PPBetEditBox:GetText(), "%d+"))
        if player5PPBetAmountValue then
            player5NewPPAmount = player5PPBetAmountValue * colouredPairPayoutReturn
            player5PPBetAmount:SetText(player5NewPPAmount .. " G")
            player5PPBetAmount:SetTextColor(0, 1, 0)

            player5PPProfitvalue = player5NewPPAmount - player5PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5totalWin = player5totalWin + tonumber(player5PPProfitvalue)
                    bankingInfo.totalWon = player5totalWin
                    player5totalProfit = player5totalProfit + tonumber(player5PPProfitvalue)
                    bankingInfo.totalProfit = player5totalProfit
                    player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5NewPPAmount)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5PPBetAmountValue = tonumber(string.match(player5PPBetAmount:GetText(), "%d+"))
        if player5PPBetAmountValue then
            player5NewPPAmount = player5PPBetAmountValue * colouredPairPayoutReturn
            player5PPBetAmount:SetText(player5NewPPAmount .. " G")
            player5PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBetsPPWin()
    player5PPSideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5NewPPAmount)

end

function player5PerfectPairWin(message)

    if playerName == unitName5 then
        player5PPBetAmountValue = tonumber(string.match(player5PPBetEditBox:GetText(), "%d+"))
        if player5PPBetAmountValue then
            player5NewPPAmount = player5PPBetAmountValue * perfectPairPayoutReturn
            player5PPBetAmount:SetText(player5NewPPAmount .. " G")
            player5PPBetAmount:SetTextColor(0, 1, 0)

            player5PPProfitvalue = player5NewPPAmount - player5PPBetAmountValue

                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5totalWin = player5totalWin + tonumber(player5PPProfitvalue)
                    bankingInfo.totalWon = player5totalWin
                    player5totalProfit = player5totalProfit + tonumber(player5PPProfitvalue)
                    bankingInfo.totalProfit = player5totalProfit
                    player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5NewPPAmount)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5PPBetAmountValue = tonumber(string.match(player5PPBetAmount:GetText(), "%d+"))
        if player5PPBetAmountValue then
            player5NewPPAmount = player5PPBetAmountValue * perfectPairPayoutReturn
            player5PPBetAmount:SetText(player5NewPPAmount .. " G")
            player5PPBetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBetsPPWin()
    player5PPSideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5NewPPAmount)

end

function player5SuitedThreeOfAKindWin(message)

    if playerName == unitName5 then
        player5213BetAmountValue = tonumber(string.match(player5213BetEditBox:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)

            player5213Profitvalue = player5New213Amount - player5213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalWin = player5totalWin + tonumber(player5213Profitvalue)
                bankingInfo.totalWon = player5totalWin
                player5totalProfit = player5totalProfit + tonumber(player5213Profitvalue)
                bankingInfo.totalProfit = player5totalProfit
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5New213Amount)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5213BetAmountValue = tonumber(string.match(player5213BetAmount:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * suitedThreeOfAKindPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBets213Win()
    player5213SideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5New213Amount)

end

function player5StraightFlushWin(message)

    if playerName == unitName5 then
        player5213BetAmountValue = tonumber(string.match(player5213BetEditBox:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * straightFlushPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)

            player5213Profitvalue = player5New213Amount - player5213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalWin = player5totalWin + tonumber(player5213Profitvalue)
                bankingInfo.totalWon = player5totalWin
                player5totalProfit = player5totalProfit + tonumber(player5213Profitvalue)
                bankingInfo.totalProfit = player5totalProfit
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5New213Amount)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5213BetAmountValue = tonumber(string.match(player5213BetAmount:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * straightFlushPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBets213Win()
    player5213SideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5New213Amount)

end

function player5ThreeOfAKindWin(message)

    if playerName == unitName5 then
        player5213BetAmountValue = tonumber(string.match(player5213BetEditBox:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * threeOfAKindPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)

            player5213Profitvalue = player5New213Amount - player5213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalWin = player5totalWin + tonumber(player5213Profitvalue)
                bankingInfo.totalWon = player5totalWin
                player5totalProfit = player5totalProfit + tonumber(player5213Profitvalue)
                bankingInfo.totalProfit = player5totalProfit
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5New213Amount)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5213BetAmountValue = tonumber(string.match(player5213BetAmount:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * threeOfAKindPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBets213Win()
    player5213SideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5New213Amount)

end

function player5StraightWin(message)

    if playerName == unitName5 then
        player5213BetAmountValue = tonumber(string.match(player5213BetEditBox:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * straightPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)

            player5213Profitvalue = player5New213Amount - player5213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalWin = player5totalWin + tonumber(player5213Profitvalue)
                bankingInfo.totalWon = player5totalWin
                player5totalProfit = player5totalProfit + tonumber(player5213Profitvalue)
                bankingInfo.totalProfit = player5totalProfit
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5New213Amount)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5213BetAmountValue = tonumber(string.match(player5213BetAmount:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * straightPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBets213Win()
    player5213SideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5New213Amount)

end

function player5FlushWin(message)

    if playerName == unitName5 then
        player5213BetAmountValue = tonumber(string.match(player5213BetEditBox:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * flushPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)

            player5213Profitvalue = player5New213Amount - player5213BetAmountValue

            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalWin = player5totalWin + tonumber(player5213Profitvalue)
                bankingInfo.totalWon = player5totalWin
                player5totalProfit = player5totalProfit + tonumber(player5213Profitvalue)
                bankingInfo.totalProfit = player5totalProfit
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5New213Amount)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end

            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        end
    else
        player5213BetAmountValue = tonumber(string.match(player5213BetAmount:GetText(), "%d+"))
        if player5213BetAmountValue then
            player5New213Amount = player5213BetAmountValue * flushPayoutReturn
            player5213BetAmount:SetText(player5New213Amount .. " G")
            player5213BetAmount:SetTextColor(0, 1, 0)
        end
    end

    player5PlaceBets213Win()
    player5213SideBetWin = true

    player5SessionWin = player5SessionWin + tonumber(player5New213Amount)

end

function player5Loss()
    player5MainBetValue = tonumber(string.match(player5MainBetAmount:GetText(), "%d+"))
    if player5MainBetValue then
        
        if playerName == unitName5 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalLoss = player5totalLoss + tonumber(player5MainBetValue)
                bankingInfo.totalLost = player5totalLoss
                player5totalProfit = player5totalProfit - tonumber(player5MainBetValue)
                bankingInfo.totalProfit = player5totalProfit
            end
        end

        if player5totalProfit >= 0 then
            historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
        historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")

        local player5PPBetText = player5PPBetAmount:GetText()

        if player5PPBetText and player5PPBetText ~= "" then
            player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
            
            if player5PPBetAmountValue then
                if player5PPSideBetWin == false then

                    player5PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")

                end
            end
        end

        local player5213BetText = player5213BetAmount:GetText()

        if player5213BetText and player5213BetText ~= "" then
            player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

            if player5213BetAmountValue then
                if player5213SideBetWin == false then

                    player5213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")

                end
            end
        end
    end
end

function player5SplitH1Loss()
    player5SplitHand1BetAmountValue = tonumber(string.match(player5SplitH1BetAmount:GetText(), "%d+"))
    if player5SplitHand1BetAmountValue then

        if playerName == unitName5 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalLoss = player5totalLoss + tonumber(player5SplitHand1BetAmountValue)
                bankingInfo.totalLost = player5totalLoss
                player5totalProfit = player5totalProfit - tonumber(player5SplitHand1BetAmountValue)
                bankingInfo.totalProfit = player5totalProfit
            end
        end

        historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
        historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")

        if player5totalProfit >= 0 then
            historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

    end
end

function player5SplitH2Loss()
    player5SplitHand2BetAmountValue = tonumber(string.match(player5SplitH2BetAmount:GetText(), "%d+"))
    if player5SplitHand2BetAmountValue then

        if playerName == unitName5 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalLoss = player5totalLoss + tonumber(player5SplitHand2BetAmountValue)
                bankingInfo.totalLost = player5totalLoss
                player5totalProfit = player5totalProfit - tonumber(player5SplitHand2BetAmountValue)
                bankingInfo.totalProfit = player5totalProfit
            end
        end

        historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
        historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")

        if player5totalProfit >= 0 then
            historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end

        local player5PPBetText = player5PPBetAmount:GetText()

        if player5PPBetText and player5PPBetText ~= "" then
            player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
            
            if player5PPBetAmountValue then
                if player5PPSideBetWin == false then

                    player5PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player5213BetText = player5213BetAmount:GetText()

        if player5213BetText and player5213BetText ~= "" then
            player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

            if player5213BetAmountValue then
                if player5213SideBetWin == false then

                    player5213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end
end

function player5Push()
    player5MainBetValue = tonumber(string.match(player5MainBetAmount:GetText(), "%d+"))
    if player5MainBetValue then


        if playerName == unitName5 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5MainBetValue)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end
        end

        bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

        local player5PPBetText = player5PPBetAmount:GetText()

        if player5PPBetText and player5PPBetText ~= "" then
            player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
            
            if player5PPBetAmountValue then
                if player5PPSideBetWin == false then

                    player5PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player5213BetText = player5213BetAmount:GetText()

        if player5213BetText and player5213BetText ~= "" then
            player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

            if player5213BetAmountValue then
                if player5213SideBetWin == false then

                    player5213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        player5SessionWin = player5SessionWin + tonumber(player5MainBetValue)

    end
end

function player5SplitH1Push()
    player5SplitHand1BetAmountValue = tonumber(string.match(player5SplitH1BetAmount:GetText(), "%d+"))
    if player5SplitHand1BetAmountValue then

        if playerName == unitName5 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5SplitHand1BetAmountValue)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end
        end

        bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    
        player5SessionWin = player5SessionWin + tonumber(player5SplitHand1BetAmountValue)
    
    end

end

function player5SplitH2Push()
    player5SplitHand2BetAmountValue = tonumber(string.match(player5SplitH2BetAmount:GetText(), "%d+"))
    if player5SplitHand2BetAmountValue then

        if playerName == unitName5 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5SplitHand2BetAmountValue)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end
        end

        bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

        local player5PPBetText = player5PPBetAmount:GetText()

        if player5PPBetText and player5PPBetText ~= "" then
            player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
            
            if player5PPBetAmountValue then
                if player5PPSideBetWin == false then

                    player5PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player5213BetText = player5213BetAmount:GetText()

        if player5213BetText and player5213BetText ~= "" then
            player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

            if player5213BetAmountValue then
                if player5213SideBetWin == false then

                    player5213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        player5SessionWin = player5SessionWin + tonumber(player5SplitHand2BetAmountValue)

    end
end

function player5BJWin(message)
    player5MainBetAmountValue = tonumber(string.match(player5MainBetAmount:GetText(), "%d+"))
    if player5MainBetAmountValue then
        player5BJWinAmountValue = player5MainBetAmountValue * 2.5
        player5MainBetAmount:SetText(player5BJWinAmountValue .. " G")
    end

    player5BJProfitvalue = player5BJWinAmountValue - player5MainBetAmountValue

    if playerName == unitName5 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player5totalWin = player5totalWin + tonumber(player5BJProfitvalue)
            bankingInfo.totalWon = player5totalWin
            player5totalProfit = player5totalProfit + tonumber(player5BJProfitvalue)
            bankingInfo.totalProfit = player5totalProfit
            player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5BJWinAmountValue)
            bankingInfo.bankrollTable = player5TotalBankrollAmount
        end
    end

    if player5totalProfit >= 0 then
        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
    bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

    local player5PPBetText = player5PPBetAmount:GetText()

    if player5PPBetText and player5PPBetText ~= "" then
        player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
        
        if player5PPBetAmountValue then
            if player5PPSideBetWin == false then

                player5PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName5 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                        bankingInfo.totalLost = player5totalLoss
                        player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                        bankingInfo.totalProfit = player5totalProfit
                    end
                end
        
                historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
        
                if player5totalProfit >= 0 then
                    historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player5213BetText = player5213BetAmount:GetText()

    if player5213BetText and player5213BetText ~= "" then
        player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

        if player5213BetAmountValue then
            if player5213SideBetWin == false then

                player5213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName5 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                        bankingInfo.totalLost = player5totalLoss
                        player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                        bankingInfo.totalProfit = player5totalProfit
                    end
                end
        
                historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
        
                if player5totalProfit >= 0 then
                    historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player5MainBetCoins:Hide()
    playerFrame.player5BJWinCoins:Show()

    player5SessionWin = player5SessionWin + tonumber(player5BJWinAmountValue)

end

function player5SplitH1BJ(message)
    player5SplitHand1BetAmountValue = tonumber(string.match(player5SplitH1BetAmount:GetText(), "%d+"))
    if player5SplitHand1BetAmountValue then
        player5SplitHand1BJWinAmountValue = player5SplitHand1BetAmountValue * 2.5
        player5SplitH1BetAmount:SetText(player5SplitHand1BJWinAmountValue .. " G")
    end

    player5SplitHand1BJProfitValue = player5SplitHand1BJWinAmountValue - player5SplitHand1BetAmountValue

    if playerName == unitName5 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player5totalWin = player5totalWin + tonumber(player5SplitHand1BJProfitValue)
            bankingInfo.totalWon = player5totalWin
            player5totalProfit = player5totalProfit + tonumber(player5SplitHand1BJProfitValue)
            bankingInfo.totalProfit = player5totalProfit
            player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5SplitHand1BJWinAmountValue)
            bankingInfo.bankrollTable = player5TotalBankrollAmount
        end
    end

    if player5totalProfit >= 0 then
        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
    bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

    playerFrame.player5SplitHand1Coins:Hide()
    playerFrame.player5SplitHand1BJWinCoins:Show()

    player5SessionWin = player5SessionWin + tonumber(player5SplitHand1BJWinAmountValue)

end

function player5SplitH2BJ(message)
    player5SplitHand2BetAmountValue = tonumber(string.match(player5SplitH2BetAmount:GetText(), "%d+"))
    if player5SplitHand2BetAmountValue then
        player5SplitHand2BJWinAmountValue = player5SplitHand2BetAmountValue * 2.5
        player5SplitH2BetAmount:SetText(player5SplitHand2BJWinAmountValue .. " G")
    end

    player5SplitHand2BJProfitValue = player5SplitHand2BJWinAmountValue - player5SplitHand2BetAmountValue

    if playerName == unitName5 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player5totalWin = player5totalWin + tonumber(player5SplitHand2BJProfitValue)
            bankingInfo.totalWon = player5totalWin
            player5totalProfit = player5totalProfit + tonumber(player5SplitHand2BJProfitValue)
            bankingInfo.totalProfit = player5totalProfit
            player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5SplitHand2BJWinAmountValue)
            bankingInfo.bankrollTable = player5TotalBankrollAmount
        end
    end

    if player5totalProfit >= 0 then
        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
    bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

    local player5PPBetText = player5PPBetAmount:GetText()

    if player5PPBetText and player5PPBetText ~= "" then
        player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
        
        if player5PPBetAmountValue then
            if player5PPSideBetWin == false then

                player5PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName5 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                        bankingInfo.totalLost = player5totalLoss
                        player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                        bankingInfo.totalProfit = player5totalProfit
                    end
                end
        
                historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
        
                if player5totalProfit >= 0 then
                    historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player5213BetText = player5213BetAmount:GetText()

    if player5213BetText and player5213BetText ~= "" then
        player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

        if player5213BetAmountValue then
            if player5213SideBetWin == false then

                player5213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName5 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                        bankingInfo.totalLost = player5totalLoss
                        player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                        bankingInfo.totalProfit = player5totalProfit
                    end
                end
        
                historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
        
                if player5totalProfit >= 0 then
                    historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player5SplitHand2Coins:Hide()
    playerFrame.player5SplitHand2BJWinCoins:Show()

    player5SessionWin = player5SessionWin + tonumber(player5SplitHand2BJWinAmountValue)

end

function player5Win(message)
    player5MainBetAmountValue = tonumber(string.match(player5MainBetAmount:GetText(), "%d+"))
    if player5MainBetAmountValue then
        player5NormalWinAmountValue = player5MainBetAmountValue * 2
        player5MainBetAmount:SetText(player5NormalWinAmountValue .. " G")

        if playerName == unitName5 then
            if playerBankingInfo[playerName] then
                local bankingInfo = playerBankingInfo[playerName]
                player5totalWin = player5totalWin + tonumber(player5MainBetAmountValue)
                bankingInfo.totalWon = player5totalWin
                player5totalProfit = player5totalProfit + tonumber(player5MainBetAmountValue)
                bankingInfo.totalProfit = player5totalProfit
                player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5NormalWinAmountValue)
                bankingInfo.bankrollTable = player5TotalBankrollAmount
            end
        end
    
        if player5totalProfit >= 0 then
            historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
        else
            historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
        end
    
        historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
        historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
        bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

        local player5PPBetText = player5PPBetAmount:GetText()

        if player5PPBetText and player5PPBetText ~= "" then
            player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
            
            if player5PPBetAmountValue then
                if player5PPSideBetWin == false then

                    player5PPBetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end

        local player5213BetText = player5213BetAmount:GetText()

        if player5213BetText and player5213BetText ~= "" then
            player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

            if player5213BetAmountValue then
                if player5213SideBetWin == false then

                    player5213BetAmount:SetTextColor(1, 0, 0)

                    if playerName == unitName5 then
                        if playerBankingInfo[playerName] then
                            local bankingInfo = playerBankingInfo[playerName]
                            player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                            bankingInfo.totalLost = player5totalLoss
                            player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                            bankingInfo.totalProfit = player5totalProfit
                        end
                    end
            
                    historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            
                    if player5totalProfit >= 0 then
                        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                    else
                        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                    end

                end
            end
        end
    end

    playerFrame.player5MainBetCoins:Hide()
    playerFrame.player5NormalWinCoins:Show()

    player5SessionWin = player5SessionWin + tonumber(player5NormalWinAmountValue)

end

function player5SplitH1Win(message)
    player5SplitHand1BetAmountValue = tonumber(string.match(player5SplitH1BetAmount:GetText(), "%d+"))
    if player5SplitHand1BetAmountValue then
        player5SplitHand1NormalWinAmountValue = player5SplitHand1BetAmountValue * 2
        player5SplitH1BetAmount:SetText(player5SplitHand1NormalWinAmountValue .. " G")
    end

    if playerName == unitName5 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player5totalWin = player5totalWin + tonumber(player5SplitHand1BetAmountValue)
            bankingInfo.totalWon = player5totalWin
            player5totalProfit = player5totalProfit + tonumber(player5SplitHand1BetAmountValue)
            bankingInfo.totalProfit = player5totalProfit
            player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5SplitHand1NormalWinAmountValue)
            bankingInfo.bankrollTable = player5TotalBankrollAmount
        end
    end

    if player5totalProfit >= 0 then
        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
    bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

    playerFrame.player5SplitHand1Coins:Hide()
    playerFrame.player5SplitHand1NormalWinCoins:Show()

    player5SessionWin = player5SessionWin + tonumber(player5SplitHand1NormalWinAmountValue)

end

function player5SplitH2Win(message)
    player5SplitHand2BetAmountValue = tonumber(string.match(player5SplitH2BetAmount:GetText(), "%d+"))
    if player5SplitHand2BetAmountValue then
        player5SplitHand2NormalWinAmountValue = player5SplitHand2BetAmountValue * 2
        player5SplitH2BetAmount:SetText(player5SplitHand2NormalWinAmountValue .. " G")
    end

    if playerName == unitName5 then
        if playerBankingInfo[playerName] then
            local bankingInfo = playerBankingInfo[playerName]
            player5totalWin = player5totalWin + tonumber(player5SplitHand2BetAmountValue)
            bankingInfo.totalWon = player5totalWin
            player5totalProfit = player5totalProfit + tonumber(player5SplitHand2BetAmountValue)
            bankingInfo.totalProfit = player5totalProfit
            player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5SplitHand2NormalWinAmountValue)
            bankingInfo.bankrollTable = player5TotalBankrollAmount
        end
    end

    if player5totalProfit >= 0 then
        historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
    else
        historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
    end

    historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
    historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
    bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

    local player5PPBetText = player5PPBetAmount:GetText()

    if player5PPBetText and player5PPBetText ~= "" then
        player5PPBetAmountValue = tonumber(string.match(player5PPBetText, "%d+"))
        
        if player5PPBetAmountValue then
            if player5PPSideBetWin == false then

                player5PPBetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName5 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player5totalLoss = player5totalLoss + tonumber(player5PPBetAmountValue)
                        bankingInfo.totalLost = player5totalLoss
                        player5totalProfit = player5totalProfit - tonumber(player5PPBetAmountValue)
                        bankingInfo.totalProfit = player5totalProfit
                    end
                end
        
                historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
        
                if player5totalProfit >= 0 then
                    historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    local player5213BetText = player5213BetAmount:GetText()

    if player5213BetText and player5213BetText ~= "" then
        player5213BetAmountValue = tonumber(string.match(player5213BetText, "%d+"))

        if player5213BetAmountValue then
            if player5213SideBetWin == false then

                player5213BetAmount:SetTextColor(1, 0, 0)

                if playerName == unitName5 then
                    if playerBankingInfo[playerName] then
                        local bankingInfo = playerBankingInfo[playerName]
                        player5totalLoss = player5totalLoss + tonumber(player5213BetAmountValue)
                        bankingInfo.totalLost = player5totalLoss
                        player5totalProfit = player5totalProfit - tonumber(player5213BetAmountValue)
                        bankingInfo.totalProfit = player5totalProfit
                    end
                end
        
                historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
                historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
        
                if player5totalProfit >= 0 then
                    historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
                else
                    historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
                end

            end
        end
    end

    playerFrame.player5SplitHand2Coins:Hide()
    playerFrame.player5SplitHand2NormalWinCoins:Show()

    player5SessionWin = player5SessionWin + tonumber(player5SplitHand2NormalWinAmountValue)

end

function player5InsuranceWin(message)

    local player5InsuranceBetText = playerFrame.player5InsuranceBetAmount:GetText()

    if player5InsuranceBetText and player5InsuranceBetText ~= "" then
        player5InsuranceBetAmountValue = tonumber(string.match(player5InsuranceBetText, "%d+"))

        if player5InsuranceBetAmountValue then
            player5InsuranceWinAmountValue = player5InsuranceBetAmountValue * 3

            player5InsuranceProfitValue = player5InsuranceWinAmountValue - player5InsuranceBetAmountValue


            if playerName == unitName5 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5totalWin = player5totalWin + tonumber(player5InsuranceProfitValue)
                    bankingInfo.totalWon = player5totalWin
                    player5totalProfit = player5totalProfit + tonumber(player5InsuranceProfitValue)
                    bankingInfo.totalProfit = player5totalProfit
                    player5TotalBankrollAmount = player5TotalBankrollAmount + tonumber(player5InsuranceWinAmountValue)
                    bankingInfo.bankrollTable = player5TotalBankrollAmount
                end
            end
        
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
        
            historyFrame.player5totalWonAmount:SetText(player5totalWin .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")
            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")

            player5SessionWin = player5SessionWin + tonumber(player5InsuranceWinAmountValue)

        end
    end
end

function player5InsuranceLoss(message)

    local player5InsuranceBetText = playerFrame.player5InsuranceBetAmount:GetText()

    if player5InsuranceBetText and player5InsuranceBetText ~= "" then
        player5InsuranceBetAmountValue = tonumber(string.match(player5InsuranceBetText, "%d+"))

        if player5InsuranceBetAmountValue then

            if playerName == unitName5 then
                if playerBankingInfo[playerName] then
                    local bankingInfo = playerBankingInfo[playerName]
                    player5totalLoss = player5totalLoss + tonumber(player5InsuranceBetAmountValue)
                    bankingInfo.totalLost = player5totalLoss
                    player5totalProfit = player5totalProfit - tonumber(player5InsuranceBetAmountValue)
                    bankingInfo.totalProfit = player5totalProfit
                end
            end
    
            if player5totalProfit >= 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            else
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
    
            historyFrame.player5totalLostAmount:SetText(player5totalLoss .. " G")
            historyFrame.player5ProfitAmount:SetText(player5totalProfit .. " G")

        end
    end
end

local function player5SessionWinAnnouncement()
    if playerName == unitName5 then
        if player5SessionWinCalled == false then
            if player5SessionWin >= 2 then
                local chatFrame = SELECTED_DOCK_FRAME
                ChatFrame_OpenChat("/me", chatFrame)
                
                local editBox = _G[chatFrame:GetName().."EditBox"]
                editBox:SetText("")
                editBox:Insert("/me has won " .. player5SessionWin .. "g from a hand of Blackjack.")
                
                ChatEdit_SendText(editBox)
                ChatEdit_DeactivateChat(editBox)

                UpdateWinningsDisplay(playerFrame.player5WinningsUpdate, player5SessionWin)
                player5resetRaidChannel()
                
            else
                print("")
            end

            player5SessionWinCalled = true
        end
    end
end











-- >> TIMERS <<
-- >> TIMERS <<
-- >> TIMERS <<

-- >> PLAYER 1 <<
local function player1UpdateTimerDisplay(secondsRemaining)
    timerFrame.player1TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player1OnTimerUpdate()
    countdownDuration = countdownDuration - 1
    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player1HitButton:Disable()
        playerFrame.player1StandButton:Disable()
        playerFrame.player1DoubleButton:Disable()
        playerFrame.player1SplitButton:Disable()
        playerFrame.player1InsuranceYesButton:Disable()
        playerFrame.player1InsuranceNoButton:Disable()

        -- Players: 1
        if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player1CountdownTimer:Cancel()
        timerFrame.player1TimerText:SetText("Time is up!")
        timerFrame.player1TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName1 then
            SendChatMessage("[P1] Stand", "RAID")
        end
    else
        player1UpdateTimerDisplay(countdownDuration)
    end
end
local function player1StartCountdown()
    if player1CountdownTimer then
        player1CountdownTimer:Cancel()
    end
    player1CountdownTimer = C_Timer.NewTicker(1, player1OnTimerUpdate, countdownDuration)
    timerFrame.player1TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player1TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player1TimerText:Show()
    timerFrame.player1TimerText:SetTextColor(1, 1, 1)
end
local function player1SplitH1UpdateTimerDisplay(secondsRemaining)
    timerFrame.player1TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player1SplitH1OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player1HitButtonSplitH1:Disable()
        playerFrame.player1StandButtonSplitH1:Disable()
        playerFrame.player1DoubleButtonSplitH1:Disable()

        -- Players: 1
        if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 16

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player1SplitH1CountdownTimer:Cancel()
        timerFrame.player1TimerText:SetText("Time is up!")
        timerFrame.player1TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName1 then
            SendChatMessage("[P1] (H1) Stand", "RAID")
        end
    else
        player1SplitH1UpdateTimerDisplay(countdownDuration)
    end
end
local function player1SplitH1StartCountdown()
    if player1SplitH1CountdownTimer then
        player1SplitH1CountdownTimer:Cancel()
    end
    player1SplitH1CountdownTimer = C_Timer.NewTicker(1, player1SplitH1OnTimerUpdate, countdownDuration)
    timerFrame.player1TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player1TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player1TimerText:Show()
    timerFrame.player1TimerText:SetTextColor(1, 1, 1)
end
local function player1SplitH2UpdateTimerDisplay(secondsRemaining)
    timerFrame.player1TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player1SplitH2OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player1HitButtonSplitH2:Disable()
        playerFrame.player1StandButtonSplitH2:Disable()
        playerFrame.player1DoubleButtonSplitH2:Disable()

        -- Players: 1
        if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player1SplitH2CountdownTimer:Cancel()
        timerFrame.player1TimerText:SetText("Time is up!")
        timerFrame.player1TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName1 then
            SendChatMessage("[P1] (H2) Stand", "RAID")
        end
    else
        player1SplitH2UpdateTimerDisplay(countdownDuration)
    end
end
local function player1SplitH2StartCountdown()
    if player1SplitH2CountdownTimer then
        player1SplitH2CountdownTimer:Cancel()
    end
    player1SplitH2CountdownTimer = C_Timer.NewTicker(1, player1SplitH2OnTimerUpdate, countdownDuration)
    timerFrame.player1TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player1TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player1TimerText:Show()
    timerFrame.player1TimerText:SetTextColor(1, 1, 1)
end
-- >> PLAYER 2 <<
local function player2UpdateTimerDisplay(secondsRemaining)
    timerFrame.player2TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player2OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player2HitButton:Disable()
        playerFrame.player2StandButton:Disable()
        playerFrame.player2DoubleButton:Disable()
        playerFrame.player2SplitButton:Disable()
        playerFrame.player2InsuranceYesButton:Disable()
        playerFrame.player2InsuranceNoButton:Disable()

        -- Players: 2
        if not player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player2CountdownTimer:Cancel()
        timerFrame.player2TimerText:SetText("Time is up!")
        timerFrame.player2TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName2 then
            SendChatMessage("[P2] Stand", "RAID")
        end
    else
        player2UpdateTimerDisplay(countdownDuration)
    end
end
local function player2StartCountdown()
    if player2CountdownTimer then
        player2CountdownTimer:Cancel()
    end
    player2CountdownTimer = C_Timer.NewTicker(1, player2OnTimerUpdate, countdownDuration)
    timerFrame.player2TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player2TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player2TimerText:Show()
    timerFrame.player2TimerText:SetTextColor(1, 1, 1)
end
local function player2SplitH1UpdateTimerDisplay(secondsRemaining)
    timerFrame.player2TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player2SplitH1OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player2HitButtonSplitH1:Disable()
        playerFrame.player2StandButtonSplitH1:Disable()
        playerFrame.player2DoubleButtonSplitH1:Disable()

        -- Players: 2
        if not player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 16

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player2SplitH1CountdownTimer:Cancel()
        timerFrame.player2TimerText:SetText("Time is up!")
        timerFrame.player2TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName2 then
            SendChatMessage("[P2] (H1) Stand", "RAID")
        end
    else
        player2SplitH1UpdateTimerDisplay(countdownDuration)
    end
end
local function player2SplitH1StartCountdown()
    if player2SplitH1CountdownTimer then
        player2SplitH1CountdownTimer:Cancel()
    end
    player2SplitH1CountdownTimer = C_Timer.NewTicker(1, player2SplitH1OnTimerUpdate, countdownDuration)
    timerFrame.player2TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player2TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player2TimerText:Show()
    timerFrame.player2TimerText:SetTextColor(1, 1, 1)
end
local function player2SplitH2UpdateTimerDisplay(secondsRemaining)
    timerFrame.player2TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player2SplitH2OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player2HitButtonSplitH2:Disable()
        playerFrame.player2StandButtonSplitH2:Disable()
        playerFrame.player2DoubleButtonSplitH2:Disable()

        -- Players: 2
        if not player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player2SplitH2CountdownTimer:Cancel()
        timerFrame.player2TimerText:SetText("Time is up!")
        timerFrame.player2TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName2 then
            SendChatMessage("[P2] (H2) Stand", "RAID")
        end
    else
        player2SplitH2UpdateTimerDisplay(countdownDuration)
    end
end
local function player2SplitH2StartCountdown()
    if player2SplitH2CountdownTimer then
        player2SplitH2CountdownTimer:Cancel()
    end
    player2SplitH2CountdownTimer = C_Timer.NewTicker(1, player2SplitH2OnTimerUpdate, countdownDuration)
    timerFrame.player2TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player2TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player2TimerText:Show()
    timerFrame.player2TimerText:SetTextColor(1, 1, 1)
end
-- >> PLAYER 3 <<
local function player3UpdateTimerDisplay(secondsRemaining)
    timerFrame.player3TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player3OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player3HitButton:Disable()
        playerFrame.player3StandButton:Disable()
        playerFrame.player3DoubleButton:Disable()
        playerFrame.player3SplitButton:Disable()
        playerFrame.player3InsuranceYesButton:Disable()
        playerFrame.player3InsuranceNoButton:Disable()

        -- Players: 3
        if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player3CountdownTimer:Cancel()
        timerFrame.player3TimerText:SetText("Time is up!")
        timerFrame.player3TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName3 then
            SendChatMessage("[P3] Stand", "RAID")
        end
    else
        player3UpdateTimerDisplay(countdownDuration)
    end
end
local function player3StartCountdown()
    if player3CountdownTimer then
        player3CountdownTimer:Cancel()
    end
    player3CountdownTimer = C_Timer.NewTicker(1, player3OnTimerUpdate, countdownDuration)
    timerFrame.player3TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player3TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player3TimerText:Show()
    timerFrame.player3TimerText:SetTextColor(1, 1, 1)
end
local function player3SplitH1UpdateTimerDisplay(secondsRemaining)
    timerFrame.player3TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player3SplitH1OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player3HitButtonSplitH1:Disable()
        playerFrame.player3StandButtonSplitH1:Disable()
        playerFrame.player3DoubleButtonSplitH1:Disable()

        -- Players: 3
        if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 16

        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player3SplitH1CountdownTimer:Cancel()
        timerFrame.player3TimerText:SetText("Time is up!")
        timerFrame.player3TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName3 then
            SendChatMessage("[P3] (H1) Stand", "RAID")
        end
    else
        player3SplitH1UpdateTimerDisplay(countdownDuration)
    end
end
local function player3SplitH1StartCountdown()
    if player3SplitH1CountdownTimer then
        player3SplitH1CountdownTimer:Cancel()
    end
    player3SplitH1CountdownTimer = C_Timer.NewTicker(1, player3SplitH1OnTimerUpdate, countdownDuration)
    timerFrame.player3TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player3TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player3TimerText:Show()
    timerFrame.player3TimerText:SetTextColor(1, 1, 1)
end
local function player3SplitH2UpdateTimerDisplay(secondsRemaining)
    timerFrame.player3TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player3SplitH2OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player3HitButtonSplitH2:Disable()
        playerFrame.player3StandButtonSplitH2:Disable()
        playerFrame.player3DoubleButtonSplitH2:Disable()

        -- Players: 3
        if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 11
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player3SplitH2CountdownTimer:Cancel()
        timerFrame.player3TimerText:SetText("Time is up!")
        timerFrame.player3TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName3 then
            SendChatMessage("[P3] (H2) Stand", "RAID")
        end
    else
        player3SplitH2UpdateTimerDisplay(countdownDuration)
    end
end
local function player3SplitH2StartCountdown()
    if player3SplitH2CountdownTimer then
        player3SplitH2CountdownTimer:Cancel()
    end
    player3SplitH2CountdownTimer = C_Timer.NewTicker(1, player3SplitH2OnTimerUpdate, countdownDuration)
    timerFrame.player3TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player3TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player3TimerText:Show()
    timerFrame.player3TimerText:SetTextColor(1, 1, 1)
end
-- >> PLAYER 4 <<
local function player4UpdateTimerDisplay(secondsRemaining)
    timerFrame.player4TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player4OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player4HitButton:Disable()
        playerFrame.player4StandButton:Disable()
        playerFrame.player4DoubleButton:Disable()
        playerFrame.player4SplitButton:Disable()
        playerFrame.player4InsuranceYesButton:Disable()
        playerFrame.player4InsuranceNoButton:Disable()

        -- Players: 4
        if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 23

        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player4CountdownTimer:Cancel()
        timerFrame.player4TimerText:SetText("Time is up!")
        timerFrame.player4TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName4 then
            SendChatMessage("[P4] Stand", "RAID")
        end
    else
        player4UpdateTimerDisplay(countdownDuration)
    end
end
local function player4StartCountdown()
    if player4CountdownTimer then
        player4CountdownTimer:Cancel()
    end
    player4CountdownTimer = C_Timer.NewTicker(1, player4OnTimerUpdate, countdownDuration)
    timerFrame.player4TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player4TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player4TimerText:Show()
    timerFrame.player4TimerText:SetTextColor(1, 1, 1)
end
local function player4SplitH1UpdateTimerDisplay(secondsRemaining)
    timerFrame.player4TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player4SplitH1OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player4HitButtonSplitH1:Disable()
        playerFrame.player4StandButtonSplitH1:Disable()
        playerFrame.player4DoubleButtonSplitH1:Disable()

        -- Players: 4
        if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 16

        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player4SplitH1CountdownTimer:Cancel()
        timerFrame.player4TimerText:SetText("Time is up!")
        timerFrame.player4TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName4 then
            SendChatMessage("[P4] (H1) Stand", "RAID")
        end
    else
        player4SplitH1UpdateTimerDisplay(countdownDuration)
    end
end
local function player4SplitH1StartCountdown()
    if player4SplitH1CountdownTimer then
        player4SplitH1CountdownTimer:Cancel()
    end
    player4SplitH1CountdownTimer = C_Timer.NewTicker(1, player4SplitH1OnTimerUpdate, countdownDuration)
    timerFrame.player4TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player4TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player4TimerText:Show()
    timerFrame.player4TimerText:SetTextColor(1, 1, 1)
end
local function player4SplitH2UpdateTimerDisplay(secondsRemaining)
    timerFrame.player4TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player4SplitH2OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player4HitButtonSplitH2:Disable()
        playerFrame.player4StandButtonSplitH2:Disable()
        playerFrame.player4DoubleButtonSplitH2:Disable()

        -- Players: 4
        if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 23

        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 11
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player4SplitH2CountdownTimer:Cancel()
        timerFrame.player4TimerText:SetText("Time is up!")
        timerFrame.player4TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName4 then
            SendChatMessage("[P4] (H2) Stand", "RAID")
        end
    else
        player4SplitH2UpdateTimerDisplay(countdownDuration)
    end
end
local function player4SplitH2StartCountdown()
    if player4SplitH2CountdownTimer then
        player4SplitH2CountdownTimer:Cancel()
    end
    player4SplitH2CountdownTimer = C_Timer.NewTicker(1, player4SplitH2OnTimerUpdate, countdownDuration)
    timerFrame.player4TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player4TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player4TimerText:Show()
    timerFrame.player4TimerText:SetTextColor(1, 1, 1)
end
-- >> PLAYER 5 <<
local function player5UpdateTimerDisplay(secondsRemaining)
    timerFrame.player5TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player5OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player5HitButton:Disable()
        playerFrame.player5StandButton:Disable()
        playerFrame.player5DoubleButton:Disable()
        playerFrame.player5SplitButton:Disable()
        playerFrame.player5InsuranceYesButton:Disable()
        playerFrame.player5InsuranceNoButton:Disable()

        -- Players: 5
        if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 23

        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player5CountdownTimer:Cancel()
        timerFrame.player5TimerText:SetText("Time is up!")
        timerFrame.player5TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName5 then
            SendChatMessage("[P5] Stand", "RAID")
        end
    else
        player5UpdateTimerDisplay(countdownDuration)
    end
end
local function player5StartCountdown()
    if player5CountdownTimer then
        player5CountdownTimer:Cancel()
    end
    player5CountdownTimer = C_Timer.NewTicker(1, player5OnTimerUpdate, countdownDuration)
    timerFrame.player5TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player5TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player5TimerText:Show()
    timerFrame.player5TimerText:SetTextColor(1, 1, 1)
end
local function player5SplitH1UpdateTimerDisplay(secondsRemaining)
    timerFrame.player5TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player5SplitH1OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player5HitButtonSplitH1:Disable()
        playerFrame.player5StandButtonSplitH1:Disable()
        playerFrame.player5DoubleButtonSplitH1:Disable()

        -- Players: 5
        if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 16

        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player5SplitH1CountdownTimer:Cancel()
        timerFrame.player5TimerText:SetText("Time is up!")
        timerFrame.player5TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName5 then
            SendChatMessage("[P5] (H1) Stand", "RAID")
        end
    else
        player5SplitH1UpdateTimerDisplay(countdownDuration)
    end
end
local function player5SplitH1StartCountdown()
    if player5SplitH1CountdownTimer then
        player5SplitH1CountdownTimer:Cancel()
    end
    player5SplitH1CountdownTimer = C_Timer.NewTicker(1, player5SplitH1OnTimerUpdate, countdownDuration)
    timerFrame.player5TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player5TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player5TimerText:Show()
    timerFrame.player5TimerText:SetTextColor(1, 1, 1)
end
local function player5SplitH2UpdateTimerDisplay(secondsRemaining)
    timerFrame.player5TimerText:SetText("Timer: " .. secondsRemaining .. " s remaining")
end
local function player5SplitH2OnTimerUpdate()
    countdownDuration = countdownDuration - 1

    if countdownDuration == 10 then
        PlaySoundFile(soundFilePaths[118])

    elseif countdownDuration <= 0 then
        playerFrame.player5HitButtonSplitH2:Disable()
        playerFrame.player5StandButtonSplitH2:Disable()
        playerFrame.player5DoubleButtonSplitH2:Disable()

        -- Players: 5
        if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 23

        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 11
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 11

        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 13
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 13
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 13

        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 15
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 15
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 15

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 17
        end

        player5SplitH2CountdownTimer:Cancel()
        timerFrame.player5TimerText:SetText("Time is up!")
        timerFrame.player5TimerText:SetTextColor(1, 0, 0)

        if playerName == unitName5 then
            SendChatMessage("[P5] (H2) Stand", "RAID")
        end
    else
        player5SplitH2UpdateTimerDisplay(countdownDuration)
    end
end
local function player5SplitH2StartCountdown()
    if player5SplitH2CountdownTimer then
        player5SplitH2CountdownTimer:Cancel()
    end
    player5SplitH2CountdownTimer = C_Timer.NewTicker(1, player5SplitH2OnTimerUpdate, countdownDuration)
    timerFrame.player5TimerText:SetPoint("CENTER", timerFrame, 0, 0)
    timerFrame.player5TimerText:SetJustifyH("CENTER")
    timerFrame:Show()
    timerFrame.player5TimerText:Show()
    timerFrame.player5TimerText:SetTextColor(1, 1, 1)
end
-- >> PLACE BETS <<
local function UpdateTimerDisplayBets(secondsRemaining)
    timerBetsFrame.timerTextBets:SetText("Place your bets!\nTimer: " .. secondsRemaining .. " s remaining")
end
local function OnTimerUpdateBets()
    countdownDuration = countdownDuration - 1

    if countdownDuration <= 0 then
        player1ConfirmMainBetButton:Disable()
        player1ConfirmPPBetButton:Disable()
        player1Confirm213BetButton:Disable()
        player1PreloadBetButton:Disable()
        player2ConfirmMainBetButton:Disable()
        player2ConfirmPPBetButton:Disable()
        player2Confirm213BetButton:Disable()
        player2PreloadBetButton:Disable()
        player3ConfirmMainBetButton:Disable()
        player3ConfirmPPBetButton:Disable()
        player3Confirm213BetButton:Disable()
        player3PreloadBetButton:Disable()
        player4ConfirmMainBetButton:Disable()
        player4ConfirmPPBetButton:Disable()
        player4Confirm213BetButton:Disable()
        player4PreloadBetButton:Disable()
        player5ConfirmMainBetButton:Disable()
        player5ConfirmPPBetButton:Disable()
        player5Confirm213BetButton:Disable()
        player5PreloadBetButton:Disable()
        countdownTimerBets:Cancel()
        timerBetsFrame.timerTextBets:SetText("No more bets!")
        timerBetsFrame.timerTextBets:SetJustifyH("CENTER")
        timerBetsFrame.timerTextBets:SetTextColor(1, 1, 0)
    else
        UpdateTimerDisplayBets(countdownDuration)
    end
end
local function StartCountdownTimerBets()
    if countdownTimerBets then
        countdownTimerBets:Cancel()
    end
    countdownTimerBets = C_Timer.NewTicker(1, OnTimerUpdateBets, countdownDuration)
    timerBetsFrame:Show()
    timerBetsFrame.timerTextBets:Show()
    timerBetsFrame.timerTextBets:SetTextColor(1, 1, 1)
end









-- >> TURNS <<
-- >> TURNS <<
-- >> TURNS <<

-- >> PLAYER 1 <<
local function player1Turn()
    playerFrame.player1HitButton:Enable()
    playerFrame.player1StandButton:Enable()
    if player1DoubleToggle == false then
        playerFrame.player1DoubleButton:Enable()
    else
        playerFrame.player1DoubleButton:Disable()
    end
end
local function player1SplitHand1Turn()
    playerFrame.player1HitButtonSplitH1:Enable()
    playerFrame.player1StandButtonSplitH1:Enable()
    if player1DoubleHand1Toggle == false then
        playerFrame.player1DoubleButtonSplitH1:Enable()
    else
        playerFrame.player1DoubleButtonSplitH1:Disable()
    end
end
local function player1SplitHand2Turn()
    playerFrame.player1HitButtonSplitH2:Enable()
    playerFrame.player1StandButtonSplitH2:Enable()
    if player1DoubleHand2Toggle == false then
        playerFrame.player1DoubleButtonSplitH2:Enable()
    else
        playerFrame.player1DoubleButtonSplitH2:Disable()
    end
end
-- >> PLAYER 2 <<
local function player2Turn()
    playerFrame.player2HitButton:Enable()
    playerFrame.player2StandButton:Enable()
    if player2DoubleToggle == false then
        playerFrame.player2DoubleButton:Enable()
    else
        playerFrame.player2DoubleButton:Disable()
    end
end
local function player2SplitHand1Turn()
    playerFrame.player2HitButtonSplitH1:Enable()
    playerFrame.player2StandButtonSplitH1:Enable()
    if player2DoubleHand1Toggle == false then
        playerFrame.player2DoubleButtonSplitH1:Enable()
    else
        playerFrame.player2DoubleButtonSplitH1:Disable()
    end
end
local function player2SplitHand2Turn()
    playerFrame.player2HitButtonSplitH2:Enable()
    playerFrame.player2StandButtonSplitH2:Enable()
    if player2DoubleHand2Toggle == false then
        playerFrame.player2DoubleButtonSplitH2:Enable()
    else
        playerFrame.player2DoubleButtonSplitH2:Disable()
    end
end
-- >> PLAYER 3 <<
local function player3Turn()
    playerFrame.player3HitButton:Enable()
    playerFrame.player3StandButton:Enable()
    if player3DoubleToggle == false then
        playerFrame.player3DoubleButton:Enable()
    else
        playerFrame.player3DoubleButton:Disable()
    end
end
local function player3SplitHand1Turn()
    playerFrame.player3HitButtonSplitH1:Enable()
    playerFrame.player3StandButtonSplitH1:Enable()
    if player3DoubleHand1Toggle == false then
        playerFrame.player3DoubleButtonSplitH1:Enable()
    else
        playerFrame.player3DoubleButtonSplitH1:Disable()
    end
end
local function player3SplitHand2Turn()
    playerFrame.player3HitButtonSplitH2:Enable()
    playerFrame.player3StandButtonSplitH2:Enable()
    if player3DoubleHand2Toggle == false then
        playerFrame.player3DoubleButtonSplitH2:Enable()
    else
        playerFrame.player3DoubleButtonSplitH2:Disable()
    end
end
-- >> PLAYER 4 <<
local function player4Turn()
    playerFrame.player4HitButton:Enable()
    playerFrame.player4StandButton:Enable()
    if player4DoubleToggle == false then
        playerFrame.player4DoubleButton:Enable()
    else
        playerFrame.player4DoubleButton:Disable()
    end
end
local function player4SplitHand1Turn()
    playerFrame.player4HitButtonSplitH1:Enable()
    playerFrame.player4StandButtonSplitH1:Enable()
    if player4DoubleHand1Toggle == false then
        playerFrame.player4DoubleButtonSplitH1:Enable()
    else
        playerFrame.player4DoubleButtonSplitH1:Disable()
    end
end
local function player4SplitHand2Turn()
    playerFrame.player4HitButtonSplitH2:Enable()
    playerFrame.player4StandButtonSplitH2:Enable()
    if player4DoubleHand2Toggle == false then
        playerFrame.player4DoubleButtonSplitH2:Enable()
    else
        playerFrame.player4DoubleButtonSplitH2:Disable()
    end
end
-- >> PLAYER 5 <<
local function player5Turn()
    playerFrame.player5HitButton:Enable()
    playerFrame.player5StandButton:Enable()
    if player5DoubleToggle == false then
        playerFrame.player5DoubleButton:Enable()
    else
        playerFrame.player5DoubleButton:Disable()
    end
end
local function player5SplitHand1Turn()
    playerFrame.player5HitButtonSplitH1:Enable()
    playerFrame.player5StandButtonSplitH1:Enable()
    if player5DoubleHand1Toggle == false then
        playerFrame.player5DoubleButtonSplitH1:Enable()
    else
        playerFrame.player5DoubleButtonSplitH1:Disable()
    end
end
local function player5SplitHand2Turn()
    playerFrame.player5HitButtonSplitH2:Enable()
    playerFrame.player5StandButtonSplitH2:Enable()
    if player5DoubleHand2Toggle == false then
        playerFrame.player5DoubleButtonSplitH2:Enable()
    else
        playerFrame.player5DoubleButtonSplitH2:Disable()
    end
end









-- >> CARD DISPLAYS <<
-- >> CARD DISPLAYS <<
-- >> CARD DISPLAYS <<

local function P12345(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 5 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 67 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 68 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 69 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 70 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 71 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 72 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 73 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 74 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 75 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 76 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 77 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 78 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 79 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 80 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 81 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 82 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 83 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 84 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 85 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 86 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 87 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 88 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 89 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 90 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 91 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 92 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 93 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 94 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 95 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 96 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 97 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 98 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 99 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 100 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 101 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 102 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 103 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 104 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 105 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 106 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 107 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 108 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 109 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 110 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 111 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 112 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 113 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 114 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 115 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 116 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end


        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 109 then
            turn = 111
        else
            turn = turn + 1
        end
    end
end

local function P2345(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 4 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 67 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 68 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 69 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 70 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 71 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 72 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 73 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 74 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 75 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 76 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 77 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 78 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 79 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 80 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 81 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 82 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 83 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 84 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 85 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 86 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 87 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 88 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 89 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 90 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 91 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 92 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 93 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 94 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end


        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 87 then
            turn = 89
        else
            turn = turn + 1
        end
    end
end
local function P1345(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 4 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 67 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 68 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 69 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 70 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 71 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 72 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 73 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 74 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 75 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 76 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 77 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 78 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 79 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 80 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 81 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 82 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 83 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 84 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 85 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 86 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 87 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 88 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 89 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 90 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 91 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 92 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 93 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 94 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end


        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 87 then
            turn = 89
        else
            turn = turn + 1
        end
    end
end
local function P1245(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 4 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 67 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 68 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 69 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 70 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 71 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 72 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 73 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 74 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 75 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 76 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 77 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 78 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 79 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 80 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 81 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 82 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 83 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 84 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 85 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 86 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 87 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 88 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 89 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 90 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 91 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 92 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 93 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 94 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end


        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 87 then
            turn = 89
        else
            turn = turn + 1
        end
    end
end
local function P1235(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 4 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 67 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 68 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 69 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 70 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 71 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 72 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 73 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 74 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 75 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 76 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 77 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 78 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 79 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 80 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 81 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 82 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 83 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 84 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 85 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 86 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 87 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 88 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 89 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 90 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 91 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 92 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 93 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 94 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end


        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 87 then
            turn = 89
        else
            turn = turn + 1
        end
    end
end
local function P1234(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 4 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 67 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 68 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 69 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 70 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 71 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 72 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 73 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 74 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 75 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 76 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 77 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 78 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 79 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 80 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 81 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 82 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 83 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 84 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 85 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 86 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 87 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 88 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 89 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 90 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 91 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 92 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 93 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 94 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end


        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 87 then
            turn = 89
        else
            turn = turn + 1
        end
    end
end

local function P345(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P245(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P235(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P234(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P145(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P135(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P134(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P125(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P124(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end
local function P123(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 3 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 45 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 46 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 47 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 48 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 49 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 50 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 51 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 52 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 53 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 54 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 55 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 56 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 57 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 58 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 59 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 60 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 61 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 62 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 63 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 64 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 65 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 66 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 67 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 68 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 69 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 70 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 71 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 72 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 65 then
            turn = 67
        else
            turn = turn + 1
        end
    end
end

local function P45(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P35(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P34(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P25(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P24(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P23(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P15(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P14(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P13(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end
local function P12(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 2 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 23 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 24 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 25 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 26 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 27 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 28 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 29 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 30 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 31 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 32 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 33 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 34 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 35 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 36 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 37 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 38 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 39 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 40 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 41 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 42 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 43 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 44 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 45 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 46 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 47 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 48 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 49 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 50 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 43 then
            turn = 45
        else
            turn = turn + 1
        end
    end
end

local function P5(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, -285, 428)       -- Player 5: 1st Card
        elseif turn == 1 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -275, 438)       -- Player 5: 2nd Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -255, 458)       -- Player 5: 4th Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -245, 468)       -- Player 5: 5th Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -235, 478)       -- Player 5: 6th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -225, 488)       -- Player 5: 7th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -243, 445)       -- Player 5: 2nd Card (Split H1)
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -280, 464)       -- Player 5: 2nd Card (Split H2)
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -223, 465)       -- Player 5: 4th Card (Split H1)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -213, 475)       -- Player 5: 5th Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -203, 485)       -- Player 5: 6th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -193, 495)       -- Player 5: 7th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -233, 455)       -- Player 5: 3rd Card (Double) (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Split H2)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -260, 484)       -- Player 5: 4th Card (Split H2)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -250, 494)       -- Player 5: 5th Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -240, 504)       -- Player 5: 6th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -230, 514)       -- Player 5: 7th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -270, 474)       -- Player 5: 3rd Card (Double) (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -265, 448)       -- Player 5: 3rd Card (Double)
        elseif turn == 23 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 24 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 25 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 26 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 27 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 28 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 21 then
            turn = 23
        else
            turn = turn + 1
        end
    end
end
local function P4(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, -165, 325)       -- Player 4: 1st Card
        elseif turn == 1 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -155, 335)       -- Player 4: 2nd Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -135, 355)       -- Player 4: 4th Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -125, 365)       -- Player 4: 5th Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -115, 375)       -- Player 4: 6th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -105, 385)       -- Player 4: 7th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 335)       -- Player 4: 2nd Card (Split H1)
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -172, 355)       -- Player 4: 2nd Card (Split H2)
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -112, 355)       -- Player 4: 4th Card (Split H1)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -102, 365)       -- Player 4: 5th Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -92, 375)       -- Player 4: 6th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -82, 385)       -- Player 4: 7th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 345)       -- Player 4: 3rd Card (Double) (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Split H2)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -152, 375)       -- Player 4: 4th Card (Split H2)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -142, 385)       -- Player 4: 5th Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -132, 395)       -- Player 4: 6th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -122, 405)       -- Player 4: 7th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -162, 365)       -- Player 4: 3rd Card (Double) (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -145, 345)       -- Player 4: 3rd Card (Double)
        elseif turn == 23 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 24 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 25 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 26 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 27 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 28 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 21 then
            turn = 23
        else
            turn = turn + 1
        end
    end
end
local function P3(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 300)       -- Player 3: 1st Card
        elseif turn == 1 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 315)       -- Player 3: 2nd Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 30, 345)       -- Player 3: 4th Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 360)       -- Player 3: 5th Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 10, 375)       -- Player 3: 6th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 390)       -- Player 3: 7th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 324)       -- Player 3: 2nd Card (Split H1)
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 324)       -- Player 3: 2nd Card (Split H2)
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 55, 354)       -- Player 3: 4th Card (Split H1)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 369)       -- Player 3: 5th Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 35, 384)       -- Player 3: 6th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 25, 399)       -- Player 3: 7th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 45, 339)       -- Player 3: 3rd Card (Double) (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Split H2)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -47, 354)       -- Player 3: 4th Card (Split H2)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 369)       -- Player 3: 5th Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -27, 384)       -- Player 3: 6th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -17, 399)       -- Player 3: 7th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, -37, 339)       -- Player 3: 3rd Card (Double) (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 330)       -- Player 3: 3rd Card (Double)
        elseif turn == 23 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 24 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 25 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 26 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 27 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 28 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 21 then
            turn = 23
        else
            turn = turn + 1
        end
    end
end
local function P2(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 325)       -- Player 2: 1st Card
        elseif turn == 1 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 335)       -- Player 2: 2nd Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 355)       -- Player 2: 4th Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 365)       -- Player 2: 5th Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 115, 375)       -- Player 2: 6th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 105, 385)       -- Player 2: 7th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 175, 360)       -- Player 2: 2nd Card (Split H1)
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 133, 340)       -- Player 2: 2nd Card (Split H2)
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 155, 380)       -- Player 2: 4th Card (Split H1)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 390)       -- Player 2: 5th Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 135, 400)       -- Player 2: 6th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 125, 410)       -- Player 2: 7th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 165, 370)       -- Player 2: 3rd Card (Double) (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Split H2)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 113, 360)       -- Player 2: 4th Card (Split H2)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 103, 370)       -- Player 2: 5th Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 93, 380)       -- Player 2: 6th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 83, 390)       -- Player 2: 7th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 123, 350)       -- Player 2: 3rd Card (Double) (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 145, 345)       -- Player 2: 3rd Card (Double)
        elseif turn == 23 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 24 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 25 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 26 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 27 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 28 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 21 then
            turn = 23
        else
            turn = turn + 1
        end
    end
end
local function P1(cardName)
    if cardName and cardNames[cardName] then
        local cardTexture = playerFrame:CreateTexture(nil, "OVERLAY")
        cardTexture:SetSize(32, 64)
        table.insert(drawnCards, cardTexture)  -- Store the texture in the table
        table.insert(dealtCards, cardNames[cardName])

        -- Position the card based on the turn count
        if turn == 0 then 
            cardTexture:SetPoint("BOTTOM", playerFrame, 296, 428)       -- Player 1: 1st Card
        elseif turn == 1 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 0, 500)         -- Dealer: 1st Card
        elseif turn == 2 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 286, 438)       -- Player 1: 2nd Card
        elseif turn == 3 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card
        elseif turn == 4 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 266, 458)       -- Player 1: 4th Card
        elseif turn == 5 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 256, 468)       -- Player 1: 5th Card
        elseif turn == 6 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 246, 478)       -- Player 1: 6th Card
        elseif turn == 7 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 236, 488)       -- Player 1: 7th Card
        elseif turn == 8 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 292, 464)       -- Player 1: 2nd Card (Split H1)
        elseif turn == 9 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 255, 445)       -- Player 1: 2nd Card (Split H2)
        elseif turn == 10 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Split H1)
        elseif turn == 11 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 272, 484)       -- Player 1: 4th Card (Split H1)
        elseif turn == 12 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 262, 494)       -- Player 1: 5th Card (Split H1)
        elseif turn == 13 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 252, 504)       -- Player 1: 6th Card (Split H1)
        elseif turn == 14 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 242, 514)       -- Player 1: 7th Card (Split H1)
        elseif turn == 15 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 282, 474)       -- Player 1: 3rd Card (Double) (Split H1)
        elseif turn == 16 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Split H2)
        elseif turn == 17 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 235, 465)       -- Player 1: 4th Card (Split H2)
        elseif turn == 18 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 225, 475)       -- Player 1: 5th Card (Split H2)
        elseif turn == 19 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 215, 485)       -- Player 1: 6th Card (Split H2)
        elseif turn == 20 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 205, 495)       -- Player 1: 7th Card (Split H2)
        elseif turn == 21 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 245, 455)       -- Player 1: 3rd Card (Double) (Split H2)
        elseif turn == 22 then
            cardTexture:SetPoint("BOTTOM", playerFrame, 276, 448)       -- Player 1: 3rd Card (Double)
        elseif turn == 23 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 20, 500)        -- Dealer: 2nd Card
        elseif turn == 24 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 40, 500)        -- Dealer: 3rd Card
        elseif turn == 25 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 60, 500)        -- Dealer: 4th Card
        elseif turn == 26 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 80, 500)        -- Dealer: 5th Card
        elseif turn == 27 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 100, 500)        -- Dealer: 6th Card
        elseif turn == 28 then
            cardTexture:SetSize(45, 90)
            cardTexture:SetPoint("BOTTOM", playerFrame, 120, 500)        -- Dealer: 7th Card
        end

        cardTexture:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. cardName)
        cardTexture:SetDrawLayer("OVERLAY")

        if turn == 21 then
            turn = 23
        else
            turn = turn + 1
        end
    end
end









-- >> HANDLE CARDS / SOUNDS <<
-- >> HANDLE CARDS / SOUNDS <<
-- >> HANDLE CARDS / SOUNDS <<

function HandleCardsP12345(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P12345(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 5 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 7 or turn == 12 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 31 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 17 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 23 or turn == 24 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 31 -- Skip to Player 2: 3rd Card
                else
                    turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 18 or turn == 25 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 31 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 18 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 31 -- Skip to Player 2: 3rd Card
                    else
                        turn = 24 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 8 or turn == 32 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 51 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 37 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 43 or turn == 44 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 51 -- Skip to Player 3: 3rd Card
                else
                    turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 38 or turn == 45 or turn == 46 or turn == 47 or turn == 48 or turn == 49 or turn == 50 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 51 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 38 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 51 -- Skip to Player 3: 3rd Card
                    else
                        turn = 44 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 9 or turn == 52 or turn == 53 or turn == 54 or turn == 55 or turn == 56 or turn == 71 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 57 or turn == 59 or turn == 60 or turn == 61 or turn == 62 or turn == 63 or turn == 64 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 63 or turn == 64 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 71 -- Skip to Player 4: 3rd Card
                else
                    turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 58 or turn == 65 or turn == 66 or turn == 67 or turn == 68 or turn == 69 or turn == 70 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 71 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 58 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 71 -- Skip to Player 4: 3rd Card
                    else
                        turn = 64 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 10 or turn == 72 or turn == 73 or turn == 74 or turn == 75 or turn == 76 or turn == 91 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 77 or turn == 79 or turn == 80 or turn == 81 or turn == 82 or turn == 83 or turn == 84 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 83 or turn == 84 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 91 -- Skip to Player 5: 3rd Card
                else
                    turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 78 or turn == 85 or turn == 86 or turn == 87 or turn == 88 or turn == 89 or turn == 90 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 91 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 78 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 91 -- Skip to Player 5: 3rd Card
                    else
                        turn = 84 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 11 or turn == 92 or turn == 93 or turn == 94 or turn == 95 or turn == 96 or turn == 111 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 11 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                            if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                                if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                                    turn = 111 -- Skip to Dealer: 2nd Card
                                else
                                    turn = 91 -- Skip to Player 5: 3rd Card
                                end
                            else
                                turn = 71 -- Skip to Player 4: 3rd Card
                            end
                        else
                            turn = 51 -- Skip to Player 3: 3rd Card
                        end
                    else
                        turn = 31 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 11 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 97 or turn == 99 or turn == 100 or turn == 101 or turn == 102 or turn == 103 or turn == 104 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 103 or turn == 104 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 111 -- Skip to Dealer: 2nd Card
                else
                    turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 98 or turn == 105 or turn == 106 or turn == 107 or turn == 108 or turn == 109 or turn == 110 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 111 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 98 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 111 -- Skip to Dealer: 2nd Card
                    else
                        turn = 104 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 6 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 112 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()

            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end

function HandleCardsP2345(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P2345(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 6 or turn == 10 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 29 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 15 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 22 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 21 or turn == 22 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 16 or turn == 23 or turn == 24 or turn == 25 or turn == 26 or turn == 27 or turn == 28 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 16 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 29 -- Skip to Player 3: 3rd Card
                    else
                        turn = 22 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 7 or turn == 30 or turn == 31 or turn == 32 or turn == 33 or turn == 34 or turn == 49 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 35 or turn == 37 or turn == 38 or turn == 39 or turn == 40 or turn == 41 or turn == 42 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 41 or turn == 42 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 36 or turn == 43 or turn == 44 or turn == 45 or turn == 46 or turn == 47 or turn == 48 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 36 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 49 -- Skip to Player 4: 3rd Card
                    else
                        turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 8 or turn == 50 or turn == 51 or turn == 52 or turn == 53 or turn == 54 or turn == 69 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 55 or turn == 57 or turn == 58 or turn == 59 or turn == 60 or turn == 61 or turn == 62 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 61 or turn == 62 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 56 or turn == 63 or turn == 64 or turn == 65 or turn == 66 or turn == 67 or turn == 68 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 56 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 69 -- Skip to Player 5: 3rd Card
                    else
                        turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 9 or turn == 70 or turn == 71 or turn == 72 or turn == 73 or turn == 74 or turn == 89 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 9 then
                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                            if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                                turn = 89 -- Skip to Dealer: 2nd Card
                            else
                                turn = 69 -- Skip to Player 5: 3rd Card
                            end
                        else
                            turn = 49 -- Skip to Player 4: 3rd Card
                        end
                    else
                        turn = 29 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 9 -- Skip to Player 2: 3rd Card
                end
            end
        elseif turn == 75 or turn == 77 or turn == 78 or turn == 79 or turn == 80 or turn == 81 or turn == 82 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 81 or turn == 82 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 76 or turn == 83 or turn == 84 or turn == 85 or turn == 86 or turn == 87 or turn == 88 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 76 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 89 -- Skip to Dealer: 2nd Card
                    else
                        turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 5 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 90 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP1345(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P1345(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 6 or turn == 10 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 29 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 15 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 22 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 21 or turn == 22 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 3: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 16 or turn == 23 or turn == 24 or turn == 25 or turn == 26 or turn == 27 or turn == 28 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 16 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 29 -- Skip to Player 3: 3rd Card
                    else
                        turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 7 or turn == 30 or turn == 31 or turn == 32 or turn == 33 or turn == 34 or turn == 49 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 35 or turn == 37 or turn == 38 or turn == 39 or turn == 40 or turn == 41 or turn == 42 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 41 or turn == 42 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 36 or turn == 43 or turn == 44 or turn == 45 or turn == 46 or turn == 47 or turn == 48 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 36 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 49 -- Skip to Player 4: 3rd Card
                    else
                        turn = 42 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 8 or turn == 50 or turn == 51 or turn == 52 or turn == 53 or turn == 54 or turn == 69 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 55 or turn == 57 or turn == 58 or turn == 59 or turn == 60 or turn == 61 or turn == 62 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 61 or turn == 62 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 56 or turn == 63 or turn == 64 or turn == 65 or turn == 66 or turn == 67 or turn == 68 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 56 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 69 -- Skip to Player 5: 3rd Card
                    else
                        turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 9 or turn == 70 or turn == 71 or turn == 72 or turn == 73 or turn == 74 or turn == 89 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 9 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                            if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                                turn = 89 -- Skip to Dealer: 2nd Card
                            else
                                turn = 69 -- Skip to Player 5: 3rd Card
                            end
                        else
                            turn = 49 -- Skip to Player 4: 3rd Card
                        end
                    else
                        turn = 29 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 9 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 75 or turn == 77 or turn == 78 or turn == 79 or turn == 80 or turn == 81 or turn == 82 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 81 or turn == 82 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 76 or turn == 83 or turn == 84 or turn == 85 or turn == 86 or turn == 87 or turn == 88 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 76 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 89 -- Skip to Dealer: 2nd Card
                    else
                        turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 5 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 90 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP1245(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P1245(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 6 or turn == 10 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 29 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 15 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 22 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 21 or turn == 22 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 16 or turn == 23 or turn == 24 or turn == 25 or turn == 26 or turn == 27 or turn == 28 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 16 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 29 -- Skip to Player 2: 3rd Card
                    else
                        turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 7 or turn == 30 or turn == 31 or turn == 32 or turn == 33 or turn == 34 or turn == 49 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 35 or turn == 37 or turn == 38 or turn == 39 or turn == 40 or turn == 41 or turn == 42 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 41 or turn == 42 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 4: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 36 or turn == 43 or turn == 44 or turn == 45 or turn == 46 or turn == 47 or turn == 48 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 36 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 49 -- Skip to Player 4: 3rd Card
                    else
                        turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 8 or turn == 50 or turn == 51 or turn == 52 or turn == 53 or turn == 54 or turn == 69 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 55 or turn == 57 or turn == 58 or turn == 59 or turn == 60 or turn == 61 or turn == 62 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 61 or turn == 62 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 56 or turn == 63 or turn == 64 or turn == 65 or turn == 66 or turn == 67 or turn == 68 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 56 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 69 -- Skip to Player 5: 3rd Card
                    else
                        turn = 62 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 9 or turn == 70 or turn == 71 or turn == 72 or turn == 73 or turn == 74 or turn == 89 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 9 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                            if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                                turn = 89 -- Skip to Dealer: 2nd Card
                            else
                                turn = 69 -- Skip to Player 5: 3rd Card
                            end
                        else
                            turn = 49 -- Skip to Player 4: 3rd Card
                        end
                    else
                        turn = 29 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 9 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 75 or turn == 77 or turn == 78 or turn == 79 or turn == 80 or turn == 81 or turn == 82 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 81 or turn == 82 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 76 or turn == 83 or turn == 84 or turn == 85 or turn == 86 or turn == 87 or turn == 88 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 76 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 89 -- Skip to Dealer: 2nd Card
                    else
                        turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 5 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 90 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP1235(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P1235(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 6 or turn == 10 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 29 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 15 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 22 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 21 or turn == 22 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 16 or turn == 23 or turn == 24 or turn == 25 or turn == 26 or turn == 27 or turn == 28 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 16 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 29 -- Skip to Player 2: 3rd Card
                    else
                        turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 7 or turn == 30 or turn == 31 or turn == 32 or turn == 33 or turn == 34 or turn == 49 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 35 or turn == 37 or turn == 38 or turn == 39 or turn == 40 or turn == 41 or turn == 42 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 41 or turn == 42 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 36 or turn == 43 or turn == 44 or turn == 45 or turn == 46 or turn == 47 or turn == 48 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 36 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 49 -- Skip to Player 3: 3rd Card
                    else
                        turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 8 or turn == 50 or turn == 51 or turn == 52 or turn == 53 or turn == 54 or turn == 69 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 55 or turn == 57 or turn == 58 or turn == 59 or turn == 60 or turn == 61 or turn == 62 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 61 or turn == 62 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 5: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 56 or turn == 63 or turn == 64 or turn == 65 or turn == 66 or turn == 67 or turn == 68 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 56 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 69 -- Skip to Player 5: 3rd Card
                    else
                        turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 9 or turn == 70 or turn == 71 or turn == 72 or turn == 73 or turn == 74 or turn == 89 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 9 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                            if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                                turn = 89 -- Skip to Dealer: 2nd Card
                            else
                                turn = 69 -- Skip to Player 5: 3rd Card
                            end
                        else
                            turn = 49 -- Skip to Player 3: 3rd Card
                        end
                    else
                        turn = 29 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 9 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 75 or turn == 77 or turn == 78 or turn == 79 or turn == 80 or turn == 81 or turn == 82 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 81 or turn == 82 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 76 or turn == 83 or turn == 84 or turn == 85 or turn == 86 or turn == 87 or turn == 88 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 76 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 89 -- Skip to Dealer: 2nd Card
                    else
                        turn = 82 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 5 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 90 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP1234(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P1234(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 6 or turn == 10 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 29 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 15 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 22 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 21 or turn == 22 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 29 -- Skip to Player 2: 3rd Card
                else
                    turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 16 or turn == 23 or turn == 24 or turn == 25 or turn == 26 or turn == 27 or turn == 28 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 29 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 16 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 29 -- Skip to Player 2: 3rd Card
                    else
                        turn = 22 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 7 or turn == 30 or turn == 31 or turn == 32 or turn == 33 or turn == 34 or turn == 49 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 35 or turn == 37 or turn == 38 or turn == 39 or turn == 40 or turn == 41 or turn == 42 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 41 or turn == 42 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 49 -- Skip to Player 3: 3rd Card
                else
                    turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 36 or turn == 43 or turn == 44 or turn == 45 or turn == 46 or turn == 47 or turn == 48 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 49 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 36 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 49 -- Skip to Player 3: 3rd Card
                    else
                        turn = 42 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 8 or turn == 50 or turn == 51 or turn == 52 or turn == 53 or turn == 54 or turn == 69 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 55 or turn == 57 or turn == 58 or turn == 59 or turn == 60 or turn == 61 or turn == 62 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 61 or turn == 62 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 69 -- Skip to Player 4: 3rd Card
                else
                    turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 56 or turn == 63 or turn == 64 or turn == 65 or turn == 66 or turn == 67 or turn == 68 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 69 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 56 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 69 -- Skip to Player 4: 3rd Card
                    else
                        turn = 62 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 9 or turn == 70 or turn == 71 or turn == 72 or turn == 73 or turn == 74 or turn == 89 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
            if turn == 9 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                            if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                                turn = 89 -- Skip to Dealer: 2nd Card
                            else
                                turn = 69 -- Skip to Player 4: 3rd Card
                            end
                        else
                            turn = 49 -- Skip to Player 3: 3rd Card
                        end
                    else
                        turn = 29 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 9 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 75 or turn == 77 or turn == 78 or turn == 79 or turn == 80 or turn == 81 or turn == 82 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 81 or turn == 82 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 89 -- Skip to Dealer: 2nd Card
                else
                    turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 76 or turn == 83 or turn == 84 or turn == 85 or turn == 86 or turn == 87 or turn == 88 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 89 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 76 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 89 -- Skip to Dealer: 2nd Card
                    else
                        turn = 82 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 5 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 90 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end

function HandleCardsP345(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P345(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 4: 3rd Card
                    else
                        turn = 20 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 5: 3rd Card
                    else
                        turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 5: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 4: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 3: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP245(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P245(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 4: 3rd Card
                    else
                        turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 5: 3rd Card
                    else
                        turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 5: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 4: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 2: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP235(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P235(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 3: 3rd Card
                    else
                        turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 5: 3rd Card
                    else
                        turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 5: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 2: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP234(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P234(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 3: 3rd Card
                    else
                        turn = 20 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 4: 3rd Card
                    else
                        turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 5: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 2: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP145(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P145(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 4: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 4: 3rd Card
                    else
                        turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 5: 3rd Card
                    else
                        turn = 40 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 5: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 4: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP135(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P135(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 3: 3rd Card
                    else
                        turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 5: 3rd Card
                    else
                        turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 5: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP134(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P134(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 3: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 3: 3rd Card
                    else
                        turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 4: 3rd Card
                    else
                        turn = 40 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 4: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP125(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P125(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 2: 3rd Card
                    else
                        turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 5: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 5: 3rd Card
                    else
                        turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 5: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP124(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P124(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 2: 3rd Card
                    else
                        turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 4: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 4: 3rd Card
                    else
                        turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 4: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP123(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P123(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 5 or turn == 8 or turn == 9 or turn == 10 or turn == 11 or turn == 12 or turn == 27 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 13 or turn == 15 or turn == 16 or turn == 17 or turn == 18 or turn == 19 or turn == 20 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 19 or turn == 20 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 27 -- Skip to Player 2: 3rd Card
                else
                    turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 14 or turn == 21 or turn == 22 or turn == 23 or turn == 24 or turn == 25 or turn == 26 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 27 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 14 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 27 -- Skip to Player 2: 3rd Card
                    else
                        turn = 20 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 6 or turn == 28 or turn == 29 or turn == 30 or turn == 31 or turn == 32 or turn == 47 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 33 or turn == 35 or turn == 36 or turn == 37 or turn == 38 or turn == 39 or turn == 40 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 39 or turn == 40 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 47 -- Skip to Player 3: 3rd Card
                else
                    turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 34 or turn == 41 or turn == 42 or turn == 43 or turn == 44 or turn == 45 or turn == 46 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 47 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 34 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 47 -- Skip to Player 3: 3rd Card
                    else
                        turn = 40 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 7 or turn == 48 or turn == 49 or turn == 50 or turn == 51 or turn == 52 or turn == 67 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
            if turn == 7 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                            turn = 67 -- Skip to Dealer: 2nd Card
                        else
                            turn = 47 -- Skip to Player 3: 3rd Card
                        end
                    else
                        turn = 27 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 7 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 53 or turn == 55 or turn == 56 or turn == 57 or turn == 58 or turn == 59 or turn == 60 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 59 or turn == 60 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 67 -- Skip to Dealer: 2nd Card
                else
                    turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 54 or turn == 61 or turn == 62 or turn == 63 or turn == 64 or turn == 65 or turn == 66 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 67 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 54 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 67 -- Skip to Dealer: 2nd Card
                    else
                        turn = 60 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 4 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 68 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end

function HandleCardsP45(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player4CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P45(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 5: 3rd Card
                    else
                        turn = 18 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 5: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 4: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP35(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player3CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P35(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 5: 3rd Card
                    else
                        turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 5: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 3: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP34(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player3CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P34(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 4: 3rd Card
                    else
                        turn = 18 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 4: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 3: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP25(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P25(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 5: 3rd Card
                    else
                        turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 5: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 2: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP24(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P24(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 4: 3rd Card
                    else
                        turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 4: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 2: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP23(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P23(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 3: 3rd Card
                    else
                        turn = 18 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 2: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP15(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P15(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 5: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 5: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 5: 3rd Card
                    else
                        turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[94])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 5: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 5: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP14(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P14(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 4: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 4: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 4: 3rd Card
                    else
                        turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[80])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 4: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 4: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP13(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player3CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P13(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 3: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 3: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 3: 3rd Card
                    else
                        turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 3: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 3: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP12(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.player2CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P12(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 4 or turn == 6 or turn == 7 or turn == 8 or turn == 9 or turn == 10 or turn == 25 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 11 or turn == 13 or turn == 14 or turn == 15 or turn == 16 or turn == 17 or turn == 18 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1 :3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 17 or turn == 18 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 25 -- Skip to Player 2: 3rd Card
                else
                    turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                end
            end
        elseif turn == 12 or turn == 19 or turn == 20 or turn == 21 or turn == 22 or turn == 23 or turn == 24 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 25 -- Skip to Player 2: 3rd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 12 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 25 -- Skip to Player 2: 3rd Card
                    else
                        turn = 18 -- Skip to Player 1: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 5 or turn == 26 or turn == 27 or turn == 28 or turn == 29 or turn == 30 or turn == 45 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
            if turn == 5 then
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 25 -- Skip to Player 2: 3rd Card
                    end
                else
                    turn = 5 -- Skip to Player 1: 3rd Card
                end
            end
        elseif turn == 31 or turn == 33 or turn == 34 or turn == 35 or turn == 36 or turn == 37 or turn == 38 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 37 or turn == 38 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 45 -- Skip to Dealer: 2nd Card
                else
                    turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                end
            end
        elseif turn == 32 or turn == 39 or turn == 40 or turn == 41 or turn == 42 or turn == 43 or turn == 44 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 45 -- Skip to Dealer: 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 32 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 45 -- Skip to Dealer: 2nd Card
                    else
                        turn = 38 -- Skip to Player 2: 3rd Card (Hand 2)
                    end
                end
            end
        end
    elseif turn == 3 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 46 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end

function HandleCardsP5(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player5CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P5(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player5CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player5CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player5CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player5CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player5CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player5CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player5CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player5CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player5CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player5CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName5) and string.find(message, "has") then
        if turn == 3 or turn == 4 or turn == 5 or turn == 6 or turn == 7 or turn == 8 or turn == 23 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player5CardTotalText:SetText("22")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player5CardTotalText:SetText("23")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player5CardTotalText:SetText("24")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player5CardTotalText:SetText("25")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player5CardTotalText:SetText("26")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player5CardTotalText:SetText("27")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player5CardTotalText:SetText("28")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player5CardTotalText:SetText("29")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player5CardTotalText:SetText("30")
                playerFrame.player5CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5CardTotalText:SetText("13")
            end
        elseif turn == 9 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 15 or turn == 16 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand1CardTotalText:SetText("21")
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand1CardTotalText:SetText("22")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand1CardTotalText:SetText("23")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand1CardTotalText:SetText("24")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand1CardTotalText:SetText("25")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand1CardTotalText:SetText("26")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand1CardTotalText:SetText("27")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand1CardTotalText:SetText("28")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand1CardTotalText:SetText("29")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand1CardTotalText:SetText("30")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand1CardTotalText:SetText("13")
            elseif turn == 15 or turn == 16 then
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                end
            end
        elseif turn == 10 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 23 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player5SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player5SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player5SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player5SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player5SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player5SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player5SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player5SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player5SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player5SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player5SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player5SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player5SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player5SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player5SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player5SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player5SplitHand2CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player5SplitHand2CardTotalText:SetText("22")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player5SplitHand2CardTotalText:SetText("23")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player5SplitHand2CardTotalText:SetText("24")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player5SplitHand2CardTotalText:SetText("25")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player5SplitHand2CardTotalText:SetText("26")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player5SplitHand2CardTotalText:SetText("27")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player5SplitHand2CardTotalText:SetText("28")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player5SplitHand2CardTotalText:SetText("29")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player5SplitHand2CardTotalText:SetText("30")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player5SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player5SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player5SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player5SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player5SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player5SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player5SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player5SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player5SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player5SplitHand2CardTotalText:SetText("13")
            elseif turn == 10 then
                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 23 -- Skip to Dealer 2nd Card
                    else
                        turn = 16 -- Skip to Player 5 3rd Card (Hand 2)
                    end
                end
            end
        end

    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 24 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP4(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player4CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P4(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player4CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player4CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player4CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player4CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player4CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player4CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player4CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player4CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player4CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player4CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName4) and string.find(message, "has") then
        if turn == 3 or turn == 4 or turn == 5 or turn == 6 or turn == 7 or turn == 8 or turn == 23 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player4CardTotalText:SetText("22")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player4CardTotalText:SetText("23")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player4CardTotalText:SetText("24")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player4CardTotalText:SetText("25")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player4CardTotalText:SetText("26")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player4CardTotalText:SetText("27")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player4CardTotalText:SetText("28")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player4CardTotalText:SetText("29")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player4CardTotalText:SetText("30")
                playerFrame.player4CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4CardTotalText:SetText("13")
            end
        elseif turn == 9 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 15 or turn == 16 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand1CardTotalText:SetText("21")
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand1CardTotalText:SetText("22")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand1CardTotalText:SetText("23")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand1CardTotalText:SetText("24")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand1CardTotalText:SetText("25")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand1CardTotalText:SetText("26")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand1CardTotalText:SetText("27")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand1CardTotalText:SetText("28")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand1CardTotalText:SetText("29")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand1CardTotalText:SetText("30")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand1CardTotalText:SetText("13")
            elseif turn == 15 or turn == 16 then
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                end
            end
        elseif turn == 10 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 23 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player4SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player4SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player4SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player4SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player4SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player4SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player4SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player4SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player4SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player4SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player4SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player4SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player4SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player4SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player4SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player4SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player4SplitHand2CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player4SplitHand2CardTotalText:SetText("22")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player4SplitHand2CardTotalText:SetText("23")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player4SplitHand2CardTotalText:SetText("24")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player4SplitHand2CardTotalText:SetText("25")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player4SplitHand2CardTotalText:SetText("26")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player4SplitHand2CardTotalText:SetText("27")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player4SplitHand2CardTotalText:SetText("28")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player4SplitHand2CardTotalText:SetText("29")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player4SplitHand2CardTotalText:SetText("30")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player4SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player4SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player4SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player4SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player4SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player4SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player4SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player4SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player4SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player4SplitHand2CardTotalText:SetText("13")
            elseif turn == 10 then
                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 23 -- Skip to Dealer 2nd Card
                    else
                        turn = 16 -- Skip to Player 4 3rd Card (Hand 2)
                    end
                end
            end
        end

    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 24 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP3(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player3CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P3(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player3CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player3CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player3CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player3CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player3CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player3CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player3CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player3CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player3CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player3CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName3) and string.find(message, "has") then
        if turn == 3 or turn == 4 or turn == 5 or turn == 6 or turn == 7 or turn == 8 or turn == 23 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[66])
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player3CardTotalText:SetText("22")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player3CardTotalText:SetText("23")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player3CardTotalText:SetText("24")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player3CardTotalText:SetText("25")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player3CardTotalText:SetText("26")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player3CardTotalText:SetText("27")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player3CardTotalText:SetText("28")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player3CardTotalText:SetText("29")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player3CardTotalText:SetText("30")
                playerFrame.player3CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3CardTotalText:SetText("13")
            end
        elseif turn == 9 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 15 or turn == 16 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand1CardTotalText:SetText("21")
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand1CardTotalText:SetText("22")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand1CardTotalText:SetText("23")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand1CardTotalText:SetText("24")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand1CardTotalText:SetText("25")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand1CardTotalText:SetText("26")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand1CardTotalText:SetText("27")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand1CardTotalText:SetText("28")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand1CardTotalText:SetText("29")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand1CardTotalText:SetText("30")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand1CardTotalText:SetText("13")
            elseif turn == 15 or turn == 16 then
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                end
            end
        elseif turn == 10 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 23 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player3SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player3SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player3SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player3SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player3SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player3SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player3SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player3SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player3SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player3SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player3SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player3SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player3SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player3SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player3SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player3SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player3SplitHand2CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player3SplitHand2CardTotalText:SetText("22")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player3SplitHand2CardTotalText:SetText("23")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player3SplitHand2CardTotalText:SetText("24")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player3SplitHand2CardTotalText:SetText("25")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player3SplitHand2CardTotalText:SetText("26")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player3SplitHand2CardTotalText:SetText("27")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player3SplitHand2CardTotalText:SetText("28")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player3SplitHand2CardTotalText:SetText("29")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player3SplitHand2CardTotalText:SetText("30")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player3SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player3SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player3SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player3SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player3SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player3SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player3SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player3SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player3SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player3SplitHand2CardTotalText:SetText("13")
            elseif turn == 10 then
                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 23 -- Skip to Dealer 2nd Card
                    else
                        turn = 16 -- Skip to Player 3 3rd Card (Hand 2)
                    end
                end
            end
        end

    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 24 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP2(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player2CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P2(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player2CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player2CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player2CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player2CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player2CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player2CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player2CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player2CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player2CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player2CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName2) and string.find(message, "has") then
        if turn == 3 or turn == 4 or turn == 5 or turn == 6 or turn == 7 or turn == 8 or turn == 23 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[52])
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player2CardTotalText:SetText("22")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player2CardTotalText:SetText("23")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player2CardTotalText:SetText("24")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player2CardTotalText:SetText("25")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player2CardTotalText:SetText("26")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player2CardTotalText:SetText("27")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player2CardTotalText:SetText("28")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player2CardTotalText:SetText("29")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player2CardTotalText:SetText("30")
                playerFrame.player2CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2CardTotalText:SetText("13")
            end
        elseif turn == 9 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 15 or turn == 16 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand1CardTotalText:SetText("21")
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand1CardTotalText:SetText("22")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand1CardTotalText:SetText("23")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand1CardTotalText:SetText("24")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand1CardTotalText:SetText("25")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand1CardTotalText:SetText("26")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand1CardTotalText:SetText("27")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand1CardTotalText:SetText("28")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand1CardTotalText:SetText("29")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand1CardTotalText:SetText("30")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand1CardTotalText:SetText("13")
            elseif turn == 15 or turn == 16 then
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                end
            end
        elseif turn == 10 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 23 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player2SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player2SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player2SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player2SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player2SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player2SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player2SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player2SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player2SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player2SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player2SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player2SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player2SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player2SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player2SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player2SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player2SplitHand2CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player2SplitHand2CardTotalText:SetText("22")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player2SplitHand2CardTotalText:SetText("23")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player2SplitHand2CardTotalText:SetText("24")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player2SplitHand2CardTotalText:SetText("25")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player2SplitHand2CardTotalText:SetText("26")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player2SplitHand2CardTotalText:SetText("27")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player2SplitHand2CardTotalText:SetText("28")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player2SplitHand2CardTotalText:SetText("29")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player2SplitHand2CardTotalText:SetText("30")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player2SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player2SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player2SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player2SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player2SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player2SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player2SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player2SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player2SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player2SplitHand2CardTotalText:SetText("13")
            elseif turn == 10 then
                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 23 -- Skip to Dealer 2nd Card
                    else
                        turn = 16 -- Skip to Player 2 3rd Card (Hand 2)
                    end
                end
            end
        end

    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 24 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end
function HandleCardsP1(message)
    -- Check if the message contains card names
    for cardName, cardFullName in pairs(cardNames) do
        playerFrame.player1CardTotalText:Show()
        playerFrame.dealerCardTotalText:Show()
        if string.find(message, cardFullName) then
            P1(cardName)
        end
    end

    local _, _, number = string.find(message, "(%d+)")

    if turn == 1 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.player1CardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.player1CardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.player1CardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.player1CardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.player1CardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.player1CardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.player1CardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.player1CardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.player1CardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.player1CardTotalText:SetText("10")
        end
    elseif string.find(message, unitName1) and string.find(message, "has") then
        if turn == 3 or turn == 4 or turn == 5 or turn == 6 or turn == 7 or turn == 8 or turn == 23 and not string.find(message, "Hand 2") then
            if string.find(message, "Blackjack") then
                PlaySoundFile(soundFilePaths[38])
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                
                playerFrame.player1CardTotalText:SetText("22")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                
                playerFrame.player1CardTotalText:SetText("23")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                
                playerFrame.player1CardTotalText:SetText("24")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                
                playerFrame.player1CardTotalText:SetText("25")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                
                playerFrame.player1CardTotalText:SetText("26")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                
                playerFrame.player1CardTotalText:SetText("27")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                
                playerFrame.player1CardTotalText:SetText("28")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                
                playerFrame.player1CardTotalText:SetText("29")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                
                playerFrame.player1CardTotalText:SetText("30")
                playerFrame.player1CardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1CardTotalText:SetText("13")
            end
        elseif turn == 9 or turn == 11 or turn == 12 or turn == 13 or turn == 14 or turn == 15 or turn == 16 then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand1CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand1CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand1CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand1CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand1CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand1CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand1CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand1CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand1CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand1CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand1CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand1CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand1CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand1CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand1CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand1CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand1CardTotalText:SetText("21")
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand1CardTotalText:SetText("22")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand1CardTotalText:SetText("23")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand1CardTotalText:SetText("24")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand1CardTotalText:SetText("25")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand1CardTotalText:SetText("26")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand1CardTotalText:SetText("27")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand1CardTotalText:SetText("28")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand1CardTotalText:SetText("29")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand1CardTotalText:SetText("30")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 0, 0)
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand1CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand1CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand1CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand1CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand1CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand1CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand1CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand1CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand1CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand1CardTotalText:SetText("13")
            elseif turn == 15 or turn == 16 then
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    turn = 23 -- Skip to Dealer 2nd Card
                else
                    turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                end
            end
        elseif turn == 10 or turn == 17 or turn == 18 or turn == 19 or turn == 20 or turn == 21 or turn == 23 and string.find(message, "Hand 2") then
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.player1SplitHand2CardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.player1SplitHand2CardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.player1SplitHand2CardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.player1SplitHand2CardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.player1SplitHand2CardTotalText:SetText("6 or 16")
            elseif string.find(message, "7 or 17") then
                PlaySoundFile(soundFilePaths[28])
                playerFrame.player1SplitHand2CardTotalText:SetText("7 or 17")
            elseif string.find(message, "8 or 18") then
                PlaySoundFile(soundFilePaths[29])
                playerFrame.player1SplitHand2CardTotalText:SetText("8 or 18")
            elseif string.find(message, "9 or 19") then
                PlaySoundFile(soundFilePaths[30])
                playerFrame.player1SplitHand2CardTotalText:SetText("9 or 19")
            elseif string.find(message, "10 or 20") then
                PlaySoundFile(soundFilePaths[31])
                playerFrame.player1SplitHand2CardTotalText:SetText("10 or 20")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.player1SplitHand2CardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.player1SplitHand2CardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.player1SplitHand2CardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.player1SplitHand2CardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.player1SplitHand2CardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.player1SplitHand2CardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.player1SplitHand2CardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.player1SplitHand2CardTotalText:SetText("21")
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "22") then
                playerFrame.player1SplitHand2CardTotalText:SetText("22")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "23") then
                playerFrame.player1SplitHand2CardTotalText:SetText("23")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "24") then
                playerFrame.player1SplitHand2CardTotalText:SetText("24")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "25") then
                playerFrame.player1SplitHand2CardTotalText:SetText("25")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "26") then
                playerFrame.player1SplitHand2CardTotalText:SetText("26")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "27") then
                playerFrame.player1SplitHand2CardTotalText:SetText("27")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "28") then
                playerFrame.player1SplitHand2CardTotalText:SetText("28")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "29") then
                playerFrame.player1SplitHand2CardTotalText:SetText("29")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "30") then
                playerFrame.player1SplitHand2CardTotalText:SetText("30")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 0, 0)
                turn = 23 -- Skip to Dealer 2nd Card
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.player1SplitHand2CardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.player1SplitHand2CardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.player1SplitHand2CardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.player1SplitHand2CardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.player1SplitHand2CardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.player1SplitHand2CardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.player1SplitHand2CardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.player1SplitHand2CardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.player1SplitHand2CardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.player1SplitHand2CardTotalText:SetText("13")
            elseif turn == 10 then
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                        turn = 23 -- Skip to Dealer 2nd Card
                    else
                        turn = 16 -- Skip to Player 1 3rd Card (Hand 2)
                    end
                end
            end
        end

    elseif turn == 2 then
        if string.find(message, "1 or 11") then
            PlaySoundFile(soundFilePaths[22])
            playerFrame.dealerCardTotalText:SetText("1 or 11")
        elseif string.find(message, "2") then
            PlaySoundFile(soundFilePaths[2])
            playerFrame.dealerCardTotalText:SetText("2")
        elseif string.find(message, "3") then
            PlaySoundFile(soundFilePaths[3])
            playerFrame.dealerCardTotalText:SetText("3")
        elseif string.find(message, "4") then
            PlaySoundFile(soundFilePaths[4])
            playerFrame.dealerCardTotalText:SetText("4")
        elseif string.find(message, "5") then
            PlaySoundFile(soundFilePaths[5])
            playerFrame.dealerCardTotalText:SetText("5")
        elseif string.find(message, "6") then
            PlaySoundFile(soundFilePaths[6])
            playerFrame.dealerCardTotalText:SetText("6")
        elseif string.find(message, "7") then
            PlaySoundFile(soundFilePaths[7])
            playerFrame.dealerCardTotalText:SetText("7")
        elseif string.find(message, "8") then
            PlaySoundFile(soundFilePaths[8])
            playerFrame.dealerCardTotalText:SetText("8")
        elseif string.find(message, "9") then
            PlaySoundFile(soundFilePaths[9])
            playerFrame.dealerCardTotalText:SetText("9")
        elseif string.find(message, "10") then
            PlaySoundFile(soundFilePaths[10])
            playerFrame.dealerCardTotalText:SetText("10")
        end

    elseif string.find(message, "Dealer") and string.find(message, "has") and not string.find(message, "turned") then
        if turn >= 24 then
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()
            if string.find(message, "2 or 12") then
                PlaySoundFile(soundFilePaths[23])
                playerFrame.dealerCardTotalText:SetText("2 or 12")
            elseif string.find(message, "3 or 13") then
                PlaySoundFile(soundFilePaths[24])
                playerFrame.dealerCardTotalText:SetText("3 or 13")
            elseif string.find(message, "4 or 14") then
                PlaySoundFile(soundFilePaths[25])
                playerFrame.dealerCardTotalText:SetText("4 or 14")
            elseif string.find(message, "5 or 15") then
                PlaySoundFile(soundFilePaths[26])
                playerFrame.dealerCardTotalText:SetText("5 or 15")
            elseif string.find(message, "6 or 16") then
                PlaySoundFile(soundFilePaths[27])
                playerFrame.dealerCardTotalText:SetText("6 or 16")
            elseif string.find(message, "14") then
                PlaySoundFile(soundFilePaths[14])
                playerFrame.dealerCardTotalText:SetText("14")
            elseif string.find(message, "15") then
                PlaySoundFile(soundFilePaths[15])
                playerFrame.dealerCardTotalText:SetText("15")
            elseif string.find(message, "16") then
                PlaySoundFile(soundFilePaths[16])
                playerFrame.dealerCardTotalText:SetText("16")
            elseif string.find(message, "17") then
                PlaySoundFile(soundFilePaths[17])
                playerFrame.dealerCardTotalText:SetText("17")
            elseif string.find(message, "18") then
                PlaySoundFile(soundFilePaths[18])
                playerFrame.dealerCardTotalText:SetText("18")
            elseif string.find(message, "19") then
                PlaySoundFile(soundFilePaths[19])
                playerFrame.dealerCardTotalText:SetText("19")
            elseif string.find(message, "20") then
                PlaySoundFile(soundFilePaths[20])
                playerFrame.dealerCardTotalText:SetText("20")
            elseif string.find(message, "21") then
                PlaySoundFile(soundFilePaths[21])
                playerFrame.dealerCardTotalText:SetText("21")
            elseif string.find(message, "22") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("22")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "23") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("23")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "24") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("24")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "25") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("25")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "26") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("26")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "27") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("27")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "28") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("28")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "29") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("29")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "30") then
                PlaySoundFile(soundFilePaths[112])
                playerFrame.dealerCardTotalText:SetText("30")
                playerFrame.dealerCardTotalText:SetTextColor(1, 0, 0)
            elseif string.find(message, "4") then
                PlaySoundFile(soundFilePaths[4])
                playerFrame.dealerCardTotalText:SetText("4")
            elseif string.find(message, "5") then
                PlaySoundFile(soundFilePaths[5])
                playerFrame.dealerCardTotalText:SetText("5")
            elseif string.find(message, "6") then
                PlaySoundFile(soundFilePaths[6])
                playerFrame.dealerCardTotalText:SetText("6")
            elseif string.find(message, "7") then
                PlaySoundFile(soundFilePaths[7])
                playerFrame.dealerCardTotalText:SetText("7")
            elseif string.find(message, "8") then
                PlaySoundFile(soundFilePaths[8])
                playerFrame.dealerCardTotalText:SetText("8")
            elseif string.find(message, "9") then
                PlaySoundFile(soundFilePaths[9])
                playerFrame.dealerCardTotalText:SetText("9")
            elseif string.find(message, "10") then
                PlaySoundFile(soundFilePaths[10])
                playerFrame.dealerCardTotalText:SetText("10")
            elseif string.find(message, "11") then
                PlaySoundFile(soundFilePaths[11])
                playerFrame.dealerCardTotalText:SetText("11")
            elseif string.find(message, "12") then
                PlaySoundFile(soundFilePaths[12])
                playerFrame.dealerCardTotalText:SetText("12")
            elseif string.find(message, "13") then
                PlaySoundFile(soundFilePaths[13])
                playerFrame.dealerCardTotalText:SetText("13")
            end
        end
    end
end








-- >> HANDLE MESSAGES <<
-- >> HANDLE MESSAGES <<
-- >> HANDLE MESSAGES <<

local function HandleChatMessage(message)
    -- Players: 1
    if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
        HandleCardsP1(message)
    -- Players: 2
    elseif not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
        HandleCardsP2(message)
    -- Players: 3
    elseif not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
        HandleCardsP3(message)
    -- Players: 4
    elseif not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
        HandleCardsP4(message)
    -- Players: 5
    elseif not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
        HandleCardsP5(message)
    
    -- Players: 1, 2
    elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
        HandleCardsP12(message)
    -- Players: 1, 3
    elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
        HandleCardsP13(message)
    -- Players: 1, 4
    elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
        HandleCardsP14(message)
    -- Players: 1, 5
    elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
        HandleCardsP15(message)
    -- Players: 2, 3
    elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
        HandleCardsP23(message)
    -- Players: 2, 4
    elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
        HandleCardsP24(message)
    -- Players: 2, 5
    elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
        HandleCardsP25(message)
    -- Players: 3, 4
    elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
        HandleCardsP34(message)
    -- Players: 3, 5
    elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
        HandleCardsP35(message)
    -- Players: 4, 5
    elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
        HandleCardsP45(message)

    -- Players: 1, 2, 3
    elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then
        HandleCardsP123(message)
    -- Players: 1, 2, 4
    elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then
        HandleCardsP124(message)
    -- Players: 1, 2, 5
    elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then
        HandleCardsP125(message)
    -- Players: 1, 3, 4
    elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then
        HandleCardsP134(message)
    -- Players: 1, 3, 5
    elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then
        HandleCardsP135(message)
    -- Players: 1, 4, 5
    elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then
        HandleCardsP145(message)
    -- Players: 2, 3, 4
    elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then
        HandleCardsP234(message)
    -- Players: 2, 3, 5
    elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then
        HandleCardsP235(message)
    -- Players: 2, 4, 5
    elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then
        HandleCardsP245(message)
    -- Players: 3, 4, 5
    elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then
        HandleCardsP345(message)

    -- Players: 1, 2, 3, 4
    elseif player1Active and player2Active and player3Active and player4Active and not player5Active then
        HandleCardsP1234(message)
    -- Players: 1, 2, 3, 5
    elseif player1Active and player2Active and player3Active and not player4Active and player5Active then
        HandleCardsP1235(message)
    -- Players: 1, 2, 4, 5
    elseif player1Active and player2Active and not player3Active and player4Active and player5Active then
        HandleCardsP1245(message)
    -- Players: 1, 3, 4, 5
    elseif player1Active and not player2Active and player3Active and player4Active and player5Active then
        HandleCardsP1345(message)
    -- Players: 2, 3, 4, 5
    elseif not player1Active and player2Active and player3Active and player4Active and player5Active then
        HandleCardsP2345(message)

    -- Players: 1, 2, 3, 4, 5
    elseif player1Active and player2Active and player3Active and player4Active and player5Active then
        HandleCardsP12345(message)
    end
end








-- >> EXTRA FUNCTIONS <<
-- >> EXTRA FUNCTIONS <<
-- >> EXTRA FUNCTIONS <<

function timerReset()
    timerFrame:Hide()
    timerBetsFrame:Hide()

    -- >> PLAYER 1 <<
    if player1CountdownTimer then
        player1CountdownTimer:Cancel()
    end
    if player1SplitH1CountdownTimer then
        player1SplitH1CountdownTimer:Cancel()
    end
    if player1SplitH2CountdownTimer then
        player1SplitH2CountdownTimer:Cancel()
    end
    timerFrame.player1TimerText:SetText("")
    timerFrame.player1TimerText:Hide()

    -- >> PLAYER 2 <<
    if player2CountdownTimer then
        player2CountdownTimer:Cancel()
    end
    if player2SplitH1CountdownTimer then
        player2SplitH1CountdownTimer:Cancel()
    end
    if player2SplitH2CountdownTimer then
        player2SplitH2CountdownTimer:Cancel()
    end
    timerFrame.player2TimerText:SetText("")
    timerFrame.player2TimerText:Hide()

    -- >> PLAYER 3 <<
    if player3CountdownTimer then
        player3CountdownTimer:Cancel()
    end
    if player3SplitH1CountdownTimer then
        player3SplitH1CountdownTimer:Cancel()
    end
    if player3SplitH2CountdownTimer then
        player3SplitH2CountdownTimer:Cancel()
    end
    timerFrame.player3TimerText:SetText("")
    timerFrame.player3TimerText:Hide()

    -- >> PLAYER 4 <<
    if player4CountdownTimer then
        player4CountdownTimer:Cancel()
    end
    if player4SplitH1CountdownTimer then
        player4SplitH1CountdownTimer:Cancel()
    end
    if player4SplitH2CountdownTimer then
        player4SplitH2CountdownTimer:Cancel()
    end
    timerFrame.player4TimerText:SetText("")
    timerFrame.player4TimerText:Hide()

    -- >> PLAYER 5 <<
    if player5CountdownTimer then
        player5CountdownTimer:Cancel()
    end
    if player5SplitH1CountdownTimer then
        player5SplitH1CountdownTimer:Cancel()
    end
    if player5SplitH2CountdownTimer then
        player5SplitH2CountdownTimer:Cancel()
    end
    timerFrame.player5TimerText:SetText("")
    timerFrame.player5TimerText:Hide()

    timerBetsFrame.timerTextBets:SetText("")
    timerBetsFrame.timerTextBets:Hide()
    countdownDuration = 30

end
function roundStarted()

    -- "Place your bets" message
    timerBetsFrame.timerTextBets:Hide()
    timerBetsFrame:Hide()
    countdownDuration = 30

    -- Player 1 bet buttons disabled
    player1ConfirmMainBetButton:Disable()
    player1ConfirmPPBetButton:Disable()
    player1Confirm213BetButton:Disable()
    player1PreloadBetButton:Disable()
    playerFrame.player1DealNowButton:Hide()
    playerFrame.player1DealNowButton:Disable()
    playerFrame.takeSeat1Button:Disable()
    playerFrame.leaveSeat1Button:Disable()

    -- Player 2 bet buttons disabled
    player2ConfirmMainBetButton:Disable()
    player2ConfirmPPBetButton:Disable()
    player2Confirm213BetButton:Disable()
    player2PreloadBetButton:Disable()
    playerFrame.player2DealNowButton:Hide()
    playerFrame.player2DealNowButton:Disable()
    playerFrame.takeSeat2Button:Disable()
    playerFrame.leaveSeat2Button:Disable()

    -- Player 3 bet buttons disabled
    player3ConfirmMainBetButton:Disable()
    player3ConfirmPPBetButton:Disable()
    player3Confirm213BetButton:Disable()
    player3PreloadBetButton:Disable()
    playerFrame.player3DealNowButton:Hide()
    playerFrame.player3DealNowButton:Disable()
    playerFrame.takeSeat3Button:Disable()
    playerFrame.leaveSeat3Button:Disable()

    -- Player 4 bet buttons disabled
    player4ConfirmMainBetButton:Disable()
    player4ConfirmPPBetButton:Disable()
    player4Confirm213BetButton:Disable()
    player4PreloadBetButton:Disable()
    playerFrame.player4DealNowButton:Hide()
    playerFrame.player4DealNowButton:Disable()
    playerFrame.takeSeat4Button:Disable()
    playerFrame.leaveSeat4Button:Disable()

    -- Player 5 bet buttons disabled
    player5ConfirmMainBetButton:Disable()
    player5ConfirmPPBetButton:Disable()
    player5Confirm213BetButton:Disable()
    player5PreloadBetButton:Disable()
    playerFrame.player5DealNowButton:Hide()
    playerFrame.player5DealNowButton:Disable()
    playerFrame.takeSeat5Button:Disable()
    playerFrame.leaveSeat5Button:Disable()

end
function insuranceAvailable()

    if playerName == unitName1 then
        -- Player 1
        if player1Active and playerFrame.player1CardTotalText:GetText() == "Blackjack" then
            playerFrame.player1InsuranceYesButton:Show()
            playerFrame.player1InsuranceNoButton:Show()
            playerFrame.player1InsuranceYesButton:Disable()
            playerFrame.player1InsuranceNoButton:Disable()
            playerFrame.player1InsuranceTitle:Show()
            playerFrame.player1InsuranceSubtitle:Show()
        else
            playerFrame.player1InsuranceYesButton:Show()
            playerFrame.player1InsuranceNoButton:Show()
            playerFrame.player1InsuranceYesButton:Enable()
            playerFrame.player1InsuranceNoButton:Enable()
            playerFrame.player1InsuranceTitle:Show()
            playerFrame.player1InsuranceSubtitle:Show()
        end
    elseif playerName == unitName2 then
        -- Player 2
        if player2Active and playerFrame.player2CardTotalText:GetText() == "Blackjack" then
            playerFrame.player2InsuranceYesButton:Show()
            playerFrame.player2InsuranceNoButton:Show()
            playerFrame.player2InsuranceYesButton:Disable()
            playerFrame.player2InsuranceNoButton:Disable()
            playerFrame.player2InsuranceTitle:Show()
            playerFrame.player2InsuranceSubtitle:Show()
        else
            playerFrame.player2InsuranceYesButton:Show()
            playerFrame.player2InsuranceNoButton:Show()
            playerFrame.player2InsuranceYesButton:Enable()
            playerFrame.player2InsuranceNoButton:Enable()
            playerFrame.player2InsuranceTitle:Show()
            playerFrame.player2InsuranceSubtitle:Show()
        end
    elseif playerName == unitName3 then
        -- Player 3
        if player3Active and playerFrame.player3CardTotalText:GetText() == "Blackjack" then
            playerFrame.player3InsuranceYesButton:Show()
            playerFrame.player3InsuranceNoButton:Show()
            playerFrame.player3InsuranceYesButton:Disable()
            playerFrame.player3InsuranceNoButton:Disable()
            playerFrame.player3InsuranceTitle:Show()
            playerFrame.player3InsuranceSubtitle:Show()
        else
            playerFrame.player3InsuranceYesButton:Show()
            playerFrame.player3InsuranceNoButton:Show()
            playerFrame.player3InsuranceYesButton:Enable()
            playerFrame.player3InsuranceNoButton:Enable()
            playerFrame.player3InsuranceTitle:Show()
            playerFrame.player3InsuranceSubtitle:Show()
        end
    elseif playerName == unitName4 then
        -- Player 4
        if player4Active and playerFrame.player4CardTotalText:GetText() == "Blackjack" then
            playerFrame.player4InsuranceYesButton:Show()
            playerFrame.player4InsuranceNoButton:Show()
            playerFrame.player4InsuranceYesButton:Disable()
            playerFrame.player4InsuranceNoButton:Disable()
            playerFrame.player4InsuranceTitle:Show()
            playerFrame.player4InsuranceSubtitle:Show()
        else
            playerFrame.player4InsuranceYesButton:Show()
            playerFrame.player4InsuranceNoButton:Show()
            playerFrame.player4InsuranceYesButton:Enable()
            playerFrame.player4InsuranceNoButton:Enable()
            playerFrame.player4InsuranceTitle:Show()
            playerFrame.player4InsuranceSubtitle:Show()
        end
    elseif playerName == unitName5 then
        -- Player 5
        if player5Active and playerFrame.player5CardTotalText:GetText() == "Blackjack" then
            playerFrame.player5InsuranceYesButton:Show()
            playerFrame.player5InsuranceNoButton:Show()
            playerFrame.player5InsuranceYesButton:Disable()
            playerFrame.player5InsuranceNoButton:Disable()
            playerFrame.player5InsuranceTitle:Show()
            playerFrame.player5InsuranceSubtitle:Show()
        else
            playerFrame.player5InsuranceYesButton:Show()
            playerFrame.player5InsuranceNoButton:Show()
            playerFrame.player5InsuranceYesButton:Enable()
            playerFrame.player5InsuranceNoButton:Enable()
            playerFrame.player5InsuranceTitle:Show()
            playerFrame.player5InsuranceSubtitle:Show()
        end
    end
end
function betReset()

    playerFrame.leaveSeat1Button:Enable()
    playerFrame.leaveSeat2Button:Enable()
    playerFrame.leaveSeat3Button:Enable()
    playerFrame.leaveSeat4Button:Enable()
    playerFrame.leaveSeat5Button:Enable()

    if tableSpectator == true then
        if playerFrame.player1Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat1Button:Enable()
        elseif playerFrame.player2Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat2Button:Enable()
        elseif playerFrame.player3Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat3Button:Enable()
        elseif playerFrame.player4Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat4Button:Enable()
        elseif playerFrame.player5Name:GetText() == "Seat Empty" then
            playerFrame.takeSeat5Button:Enable()
        end
    end

    -- >>> PLAYER 1 <<<
    -- >>> PLAYER 1 <<<
    -- >>> PLAYER 1 <<<

    -- Editboxes / Bets
    if tableLocked == true then
        player1MainBetEditBox:SetText("")
        player1MainBetEditBox:Enable()
        player1PPBetEditBox:SetText("")
        player1PPBetEditBox:Enable()
        player1213BetEditBox:SetText("")
        player1213BetEditBox:Enable()
    else
        player1MainBetEditBox:SetText("")
        player1MainBetEditBox:Enable()
        player1PPBetEditBox:SetText("")
        player1PPBetEditBox:Enable()
        player1213BetEditBox:SetText("")
        player1213BetEditBox:Enable()
        player1ConfirmMainBetButton:Enable()
        player1ConfirmPPBetButton:Enable()
        player1Confirm213BetButton:Enable()
        player1PreloadBetButton:Enable()
    end
    -- Standard Buttons
    if playerName == unitName1 then
        player1MainBetEditBox:Show()
        player1ConfirmMainBetButton:Show()
        playerFrame.player1HitButton:Show()
        playerFrame.player1StandButton:Show()
        playerFrame.player1DoubleButton:Show()
        playerFrame.player1SplitButton:Show()
        playerFrame.player1InsuranceYesButton:Hide()
        playerFrame.player1InsuranceNoButton:Hide()
        playerFrame.player1InsuranceTitle:Hide()
        playerFrame.player1InsuranceSubtitle:Hide()
        playerFrame.player1DealNowButton:Show()
        playerFrame.player1DealNowButton:Disable()
    end
    playerFrame.player1HitButton:Disable()
    playerFrame.player1StandButton:Disable()
    playerFrame.player1DoubleButton:Disable()
    playerFrame.player1SplitButton:Disable()
    playerFrame.player1InsuranceYesButton:Disable()
    playerFrame.player1InsuranceNoButton:Disable()
    -- Bet Amount Labels
    player1MainBetAmount:Hide()
    player1MainBetAmount:SetTextColor(1, 1, 1)
    player1SplitH1BetAmount:Hide()
    player1SplitH1BetAmount:SetTextColor(1, 1, 1)
    player1SplitH2BetAmount:Hide()
    player1SplitH2BetAmount:SetTextColor(1, 1, 1)
    player1PPBetAmount:Hide()
    player1PPBetAmount:SetTextColor(1, 1, 1)
    player1PPBetAmount:SetPoint("CENTER", playerFrame, 275, 60)
    player1213BetAmount:Hide()
    player1213BetAmount:SetTextColor(1, 1, 1)
    player1213BetAmount:SetPoint("CENTER", playerFrame, 345, 156)
    playerFrame.player1InsuranceBetAmount:SetText("")
    playerFrame.player1InsuranceBetAmount:Hide()
    -- Coins Images
    playerFrame.player1MainBetCoins:Hide()
    playerFrame.player1NormalWinCoins:Hide()
    playerFrame.player1SplitHand2Coins:Hide()
    playerFrame.player1SplitHand2DoubleCoins:Hide()
    playerFrame.player1SplitHand2NormalWinCoins:Hide()
    playerFrame.player1SplitHand1Coins:Hide()
    playerFrame.player1SplitHand1DoubleCoins:Hide()
    playerFrame.player1SplitHand1NormalWinCoins:Hide()
    playerFrame.player1BJWinCoins:Hide()
    playerFrame.player1SplitHand2BJWinCoins:Hide()
    playerFrame.player1SplitHand1BJWinCoins:Hide()
    playerFrame.player1DoubleBetCoins:Hide()
    playerFrame.player1PPBetCoins:Hide()
    playerFrame.player1213BetCoins:Hide()
    playerFrame.player1PPWinCoins:Hide()
    playerFrame.player1213WinCoins:Hide()
    -- Insurance Icons
    player1InsuranceYesIcon:Hide()
    player1InsuranceNoIcon:Hide()
    -- Split Buttons & Editboxes
    playerFrame.player1SplitH1Title:Hide()
    playerFrame.player1SplitH2Title:Hide()
    player1SplitH1EditBox:Hide()
    player1SplitH2EditBox:Hide()
    playerFrame.player1HitButtonSplitH1:Hide()
    playerFrame.player1StandButtonSplitH1:Hide()
    playerFrame.player1DoubleButtonSplitH1:Hide()
    playerFrame.player1HitButtonSplitH2:Hide()
    playerFrame.player1StandButtonSplitH2:Hide()
    playerFrame.player1DoubleButtonSplitH2:Hide()
    -- Card Total Text
    playerFrame.player1CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 1, 1)
    -- Card Images / Filenames
    player1MainCardName1 = nil
    player1MainCardName2 = nil
    player1MainCardName3 = nil
    player1MainCardName4 = nil
    player1MainCardName5 = nil
    player1MainCardName6 = nil
    player1MainCardName7 = nil
    player1MainCardFileName1 = nil
    player1MainCardFileName2 = nil
    player1MainCardFileName3 = nil
    player1MainCardFileName4 = nil
    player1MainCardFileName5 = nil
    player1MainCardFileName6 = nil
    player1MainCardFileName7 = nil
    player1H1CardName1 = nil
    player1H1CardName2 = nil
    player1H1CardName3 = nil
    player1H1CardName4 = nil
    player1H1CardName5 = nil
    player1H1CardName6 = nil
    player1H1CardName7 = nil
    player1H1CardFileName1 = nil
    player1H1CardFileName2 = nil
    player1H1CardFileName3 = nil
    player1H1CardFileName4 = nil
    player1H1CardFileName5 = nil
    player1H1CardFileName6 = nil
    player1H1CardFileName7 = nil
    player1H2CardName1 = nil
    player1H2CardName2 = nil
    player1H2CardName3 = nil
    player1H2CardName4 = nil
    player1H2CardName5 = nil
    player1H2CardName6 = nil
    player1H2CardName7 = nil
    player1H2CardFileName1 = nil
    player1H2CardFileName2 = nil
    player1H2CardFileName3 = nil
    player1H2CardFileName4 = nil
    player1H2CardFileName5 = nil
    player1H2CardFileName6 = nil
    player1H2CardFileName7 = nil
    -- Timers
    timerFrame.player1TimerText:SetText("")
    timerFrame.player1TimerText:Hide()
    -- Variables
    player1NumberOfCards = 0
    player1NumberOfCardsH1 = 0
    player1NumberOfCardsH2 = 0
    player1SessionWin = 0
    player1DoubleToggle = false
    player1DoubleHand1Toggle = false
    player1DoubleHand2Toggle = false
    player1SplitToggle = false
    player1PPSideBetWin = false
    player1213SideBetWin = false
    player1Active = false
    player1SessionWinCalled = false

    if player1dealtCardsFrame:IsShown() then
        player1dealtCardsFrame.notStartedYetText:Show()
    end




    -- >>> PLAYER 2 <<<
    -- >>> PLAYER 2 <<<
    -- >>> PLAYER 2 <<<
    
    -- Editboxes / Bets
    if tableLocked == true then
        player2MainBetEditBox:SetText("")
        player2MainBetEditBox:Enable()
        player2PPBetEditBox:SetText("")
        player2PPBetEditBox:Enable()
        player2213BetEditBox:SetText("")
        player2213BetEditBox:Enable()
    else
        player2MainBetEditBox:SetText("")
        player2MainBetEditBox:Enable()
        player2PPBetEditBox:SetText("")
        player2PPBetEditBox:Enable()
        player2213BetEditBox:SetText("")
        player2213BetEditBox:Enable()
        player2ConfirmMainBetButton:Enable()
        player2ConfirmPPBetButton:Enable()
        player2Confirm213BetButton:Enable()
        player2PreloadBetButton:Enable()
    end
    -- Standard Buttons
    if playerName == unitName2 then
        player2MainBetEditBox:Show()
        player2ConfirmMainBetButton:Show()
        playerFrame.player2HitButton:Show()
        playerFrame.player2StandButton:Show()
        playerFrame.player2DoubleButton:Show()
        playerFrame.player2SplitButton:Show()
        playerFrame.player2InsuranceYesButton:Hide()
        playerFrame.player2InsuranceNoButton:Hide()
        playerFrame.player2InsuranceTitle:Hide()
        playerFrame.player2InsuranceSubtitle:Hide()
        playerFrame.player2DealNowButton:Show()
        playerFrame.player2DealNowButton:Disable()
    end
    playerFrame.player2HitButton:Disable()
    playerFrame.player2StandButton:Disable()
    playerFrame.player2DoubleButton:Disable()
    playerFrame.player2SplitButton:Disable()
    playerFrame.player2InsuranceYesButton:Disable()
    playerFrame.player2InsuranceNoButton:Disable()
    -- Bet Amount Labels
    player2MainBetAmount:Hide()
    player2MainBetAmount:SetTextColor(1, 1, 1)
    player2SplitH1BetAmount:Hide()
    player2SplitH1BetAmount:SetTextColor(1, 1, 1)
    player2SplitH2BetAmount:Hide()
    player2SplitH2BetAmount:SetTextColor(1, 1, 1)
    player2PPBetAmount:Hide()
    player2PPBetAmount:SetTextColor(1, 1, 1)
    player2PPBetAmount:SetPoint("CENTER", playerFrame, 123, -23)
    player2213BetAmount:Hide()
    player2213BetAmount:SetTextColor(1, 1, 1)
    player2213BetAmount:SetPoint("CENTER", playerFrame, 231, 29)
    playerFrame.player2InsuranceBetAmount:SetText("")
    playerFrame.player2InsuranceBetAmount:Hide()
    -- Coins Images
    playerFrame.player2MainBetCoins:Hide()
    playerFrame.player2NormalWinCoins:Hide()
    playerFrame.player2SplitHand2Coins:Hide()
    playerFrame.player2SplitHand2DoubleCoins:Hide()
    playerFrame.player2SplitHand2NormalWinCoins:Hide()
    playerFrame.player2SplitHand1Coins:Hide()
    playerFrame.player2SplitHand1DoubleCoins:Hide()
    playerFrame.player2SplitHand1NormalWinCoins:Hide()
    playerFrame.player2BJWinCoins:Hide()
    playerFrame.player2SplitHand2BJWinCoins:Hide()
    playerFrame.player2SplitHand1BJWinCoins:Hide()
    playerFrame.player2DoubleBetCoins:Hide()
    playerFrame.player2PPBetCoins:Hide()
    playerFrame.player2213BetCoins:Hide()
    playerFrame.player2PPWinCoins:Hide()
    playerFrame.player2213WinCoins:Hide()
    -- Insurance Icons
    player2InsuranceYesIcon:Hide()
    player2InsuranceNoIcon:Hide()
    -- Split Buttons & Editboxes
    playerFrame.player2SplitH1Title:Hide()
    playerFrame.player2SplitH2Title:Hide()
    player2SplitH1EditBox:Hide()
    player2SplitH2EditBox:Hide()
    playerFrame.player2HitButtonSplitH1:Hide()
    playerFrame.player2StandButtonSplitH1:Hide()
    playerFrame.player2DoubleButtonSplitH1:Hide()
    playerFrame.player2HitButtonSplitH2:Hide()
    playerFrame.player2StandButtonSplitH2:Hide()
    playerFrame.player2DoubleButtonSplitH2:Hide()
    -- Card Total Text
    playerFrame.player2CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 1, 1)
    -- Card Images / Filenames
    player2MainCardName1 = nil
    player2MainCardName2 = nil
    player2MainCardName3 = nil
    player2MainCardName4 = nil
    player2MainCardName5 = nil
    player2MainCardName6 = nil
    player2MainCardName7 = nil
    player2MainCardFileName1 = nil
    player2MainCardFileName2 = nil
    player2MainCardFileName3 = nil
    player2MainCardFileName4 = nil
    player2MainCardFileName5 = nil
    player2MainCardFileName6 = nil
    player2MainCardFileName7 = nil
    player2H1CardName1 = nil
    player2H1CardName2 = nil
    player2H1CardName3 = nil
    player2H1CardName4 = nil
    player2H1CardName5 = nil
    player2H1CardName6 = nil
    player2H1CardName7 = nil
    player2H1CardFileName1 = nil
    player2H1CardFileName2 = nil
    player2H1CardFileName3 = nil
    player2H1CardFileName4 = nil
    player2H1CardFileName5 = nil
    player2H1CardFileName6 = nil
    player2H1CardFileName7 = nil
    player2H2CardName1 = nil
    player2H2CardName2 = nil
    player2H2CardName3 = nil
    player2H2CardName4 = nil
    player2H2CardName5 = nil
    player2H2CardName6 = nil
    player2H2CardName7 = nil
    player2H2CardFileName1 = nil
    player2H2CardFileName2 = nil
    player2H2CardFileName3 = nil
    player2H2CardFileName4 = nil
    player2H2CardFileName5 = nil
    player2H2CardFileName6 = nil
    player2H2CardFileName7 = nil
    -- Timers
    timerFrame.player2TimerText:SetText("")
    timerFrame.player2TimerText:Hide()
    -- Variables
    player2NumberOfCards = 0
    player2NumberOfCardsH1 = 0
    player2NumberOfCardsH2 = 0
    player2SessionWin = 0
    player2DoubleToggle = false
    player2DoubleHand1Toggle = false
    player2DoubleHand2Toggle = false
    player2SplitToggle = false
    player2PPSideBetWin = false
    player2213SideBetWin = false
    player2Active = false
    player2SessionWinCalled = false

    if player2dealtCardsFrame:IsShown() then
        player2dealtCardsFrame.notStartedYetText:Show()
    end




    -- >>> PLAYER 3 <<<
    -- >>> PLAYER 3 <<<
    -- >>> PLAYER 3 <<<
    
    -- Editboxes / Bets
    if tableLocked == true then
        player3MainBetEditBox:SetText("")
        player3MainBetEditBox:Enable()
        player3PPBetEditBox:SetText("")
        player3PPBetEditBox:Enable()
        player3213BetEditBox:SetText("")
        player3213BetEditBox:Enable()
    else
        player3MainBetEditBox:SetText("")
        player3MainBetEditBox:Enable()
        player3PPBetEditBox:SetText("")
        player3PPBetEditBox:Enable()
        player3213BetEditBox:SetText("")
        player3213BetEditBox:Enable()
        player3ConfirmMainBetButton:Enable()
        player3ConfirmPPBetButton:Enable()
        player3Confirm213BetButton:Enable()
        player3PreloadBetButton:Enable()
    end
    -- Standard Buttons
    if playerName == unitName3 then
        player3MainBetEditBox:Show()
        player3ConfirmMainBetButton:Show()
        playerFrame.player3HitButton:Show()
        playerFrame.player3StandButton:Show()
        playerFrame.player3DoubleButton:Show()
        playerFrame.player3SplitButton:Show()
        playerFrame.player3InsuranceYesButton:Hide()
        playerFrame.player3InsuranceNoButton:Hide()
        playerFrame.player3InsuranceTitle:Hide()
        playerFrame.player3InsuranceSubtitle:Hide()
        playerFrame.player3DealNowButton:Show()
        playerFrame.player3DealNowButton:Disable()
    end
    playerFrame.player3HitButton:Disable()
    playerFrame.player3StandButton:Disable()
    playerFrame.player3DoubleButton:Disable()
    playerFrame.player3SplitButton:Disable()
    playerFrame.player3InsuranceYesButton:Disable()
    playerFrame.player3InsuranceNoButton:Disable()
    -- Bet Amount Labels
    player3MainBetAmount:Hide()
    player3MainBetAmount:SetTextColor(1, 1, 1)
    player3SplitH1BetAmount:Hide()
    player3SplitH1BetAmount:SetTextColor(1, 1, 1)
    player3SplitH2BetAmount:Hide()
    player3SplitH2BetAmount:SetTextColor(1, 1, 1)
    player3PPBetAmount:Hide()
    player3PPBetAmount:SetTextColor(1, 1, 1)
    player3PPBetAmount:SetPoint("CENTER", playerFrame, -51, -35)
    player3213BetAmount:Hide()
    player3213BetAmount:SetTextColor(1, 1, 1)
    player3213BetAmount:SetPoint("CENTER", playerFrame, 67, -36)
    playerFrame.player3InsuranceBetAmount:SetText("")
    playerFrame.player3InsuranceBetAmount:Hide()
    -- Coins Images
    playerFrame.player3MainBetCoins:Hide()
    playerFrame.player3NormalWinCoins:Hide()
    playerFrame.player3SplitHand2Coins:Hide()
    playerFrame.player3SplitHand2DoubleCoins:Hide()
    playerFrame.player3SplitHand2NormalWinCoins:Hide()
    playerFrame.player3SplitHand1Coins:Hide()
    playerFrame.player3SplitHand1DoubleCoins:Hide()
    playerFrame.player3SplitHand1NormalWinCoins:Hide()
    playerFrame.player3BJWinCoins:Hide()
    playerFrame.player3SplitHand2BJWinCoins:Hide()
    playerFrame.player3SplitHand1BJWinCoins:Hide()
    playerFrame.player3DoubleBetCoins:Hide()
    playerFrame.player3PPBetCoins:Hide()
    playerFrame.player3213BetCoins:Hide()
    playerFrame.player3PPWinCoins:Hide()
    playerFrame.player3213WinCoins:Hide()
    -- Insurance Icons
    player3InsuranceYesIcon:Hide()
    player3InsuranceNoIcon:Hide()
    -- Split Buttons & Editboxes
    playerFrame.player3SplitH1Title:Hide()
    playerFrame.player3SplitH2Title:Hide()
    player3SplitH1EditBox:Hide()
    player3SplitH2EditBox:Hide()
    playerFrame.player3HitButtonSplitH1:Hide()
    playerFrame.player3StandButtonSplitH1:Hide()
    playerFrame.player3DoubleButtonSplitH1:Hide()
    playerFrame.player3HitButtonSplitH2:Hide()
    playerFrame.player3StandButtonSplitH2:Hide()
    playerFrame.player3DoubleButtonSplitH2:Hide()
    -- Card Total Text
    playerFrame.player3CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 1, 1)
    -- Card Images / Filenames
    player3MainCardName1 = nil
    player3MainCardName2 = nil
    player3MainCardName3 = nil
    player3MainCardName4 = nil
    player3MainCardName5 = nil
    player3MainCardName6 = nil
    player3MainCardName7 = nil
    player3MainCardFileName1 = nil
    player3MainCardFileName2 = nil
    player3MainCardFileName3 = nil
    player3MainCardFileName4 = nil
    player3MainCardFileName5 = nil
    player3MainCardFileName6 = nil
    player3MainCardFileName7 = nil
    player3H1CardName1 = nil
    player3H1CardName2 = nil
    player3H1CardName3 = nil
    player3H1CardName4 = nil
    player3H1CardName5 = nil
    player3H1CardName6 = nil
    player3H1CardName7 = nil
    player3H1CardFileName1 = nil
    player3H1CardFileName2 = nil
    player3H1CardFileName3 = nil
    player3H1CardFileName4 = nil
    player3H1CardFileName5 = nil
    player3H1CardFileName6 = nil
    player3H1CardFileName7 = nil
    player3H2CardName1 = nil
    player3H2CardName2 = nil
    player3H2CardName3 = nil
    player3H2CardName4 = nil
    player3H2CardName5 = nil
    player3H2CardName6 = nil
    player3H2CardName7 = nil
    player3H2CardFileName1 = nil
    player3H2CardFileName2 = nil
    player3H2CardFileName3 = nil
    player3H2CardFileName4 = nil
    player3H2CardFileName5 = nil
    player3H2CardFileName6 = nil
    player3H2CardFileName7 = nil
    -- Timers
    timerFrame.player3TimerText:SetText("")
    timerFrame.player3TimerText:Hide()
    -- Variables
    player3NumberOfCards = 0
    player3NumberOfCardsH1 = 0
    player3NumberOfCardsH2 = 0
    player3SessionWin = 0
    player3DoubleToggle = false
    player3DoubleHand1Toggle = false
    player3DoubleHand2Toggle = false
    player3SplitToggle = false
    player3PPSideBetWin = false
    player3213SideBetWin = false
    player3Active = false
    player3SessionWinCalled = false

    if player3dealtCardsFrame:IsShown() then
        player3dealtCardsFrame.notStartedYetText:Show()
    end



    -- >>> PLAYER 4 <<<
    -- >>> PLAYER 4 <<<
    -- >>> PLAYER 4 <<<
    
    -- Editboxes / Bets
    if tableLocked == true then
        player4MainBetEditBox:SetText("")
        player4MainBetEditBox:Enable()
        player4PPBetEditBox:SetText("")
        player4PPBetEditBox:Enable()
        player4213BetEditBox:SetText("")
        player4213BetEditBox:Enable()
    else
        player4MainBetEditBox:SetText("")
        player4MainBetEditBox:Enable()
        player4PPBetEditBox:SetText("")
        player4PPBetEditBox:Enable()
        player4213BetEditBox:SetText("")
        player4213BetEditBox:Enable()
        player4ConfirmMainBetButton:Enable()
        player4ConfirmPPBetButton:Enable()
        player4Confirm213BetButton:Enable()
        player4PreloadBetButton:Enable()
    end
    -- Standard Buttons
    if playerName == unitName4 then
        player4MainBetEditBox:Show()
        player4ConfirmMainBetButton:Show()
        playerFrame.player4HitButton:Show()
        playerFrame.player4StandButton:Show()
        playerFrame.player4DoubleButton:Show()
        playerFrame.player4SplitButton:Show()
        playerFrame.player4InsuranceYesButton:Hide()
        playerFrame.player4InsuranceNoButton:Hide()
        playerFrame.player4InsuranceTitle:Hide()
        playerFrame.player4InsuranceSubtitle:Hide()
        playerFrame.player4DealNowButton:Show()
        playerFrame.player4DealNowButton:Disable()
    end
    playerFrame.player4HitButton:Disable()
    playerFrame.player4StandButton:Disable()
    playerFrame.player4DoubleButton:Disable()
    playerFrame.player4SplitButton:Disable()
    playerFrame.player4InsuranceYesButton:Disable()
    playerFrame.player4InsuranceNoButton:Disable()
    -- Bet Amount Labels
    player4MainBetAmount:Hide()
    player4MainBetAmount:SetTextColor(1, 1, 1)
    player4SplitH1BetAmount:Hide()
    player4SplitH1BetAmount:SetTextColor(1, 1, 1)
    player4SplitH2BetAmount:Hide()
    player4SplitH2BetAmount:SetTextColor(1, 1, 1)
    player4PPBetAmount:Hide()
    player4PPBetAmount:SetTextColor(1, 1, 1)
    player4PPBetAmount:SetPoint("CENTER", playerFrame, -219, 26)
    player4213BetAmount:Hide()
    player4213BetAmount:SetTextColor(1, 1, 1)
    player4213BetAmount:SetPoint("CENTER", playerFrame, -107, -25)
    playerFrame.player4InsuranceBetAmount:SetText("")
    playerFrame.player4InsuranceBetAmount:Hide()
    -- Coins Images
    playerFrame.player4MainBetCoins:Hide()
    playerFrame.player4NormalWinCoins:Hide()
    playerFrame.player4SplitHand2Coins:Hide()
    playerFrame.player4SplitHand2DoubleCoins:Hide()
    playerFrame.player4SplitHand2NormalWinCoins:Hide()
    playerFrame.player4SplitHand1Coins:Hide()
    playerFrame.player4SplitHand1DoubleCoins:Hide()
    playerFrame.player4SplitHand1NormalWinCoins:Hide()
    playerFrame.player4BJWinCoins:Hide()
    playerFrame.player4SplitHand2BJWinCoins:Hide()
    playerFrame.player4SplitHand1BJWinCoins:Hide()
    playerFrame.player4DoubleBetCoins:Hide()
    playerFrame.player4PPBetCoins:Hide()
    playerFrame.player4213BetCoins:Hide()
    playerFrame.player4PPWinCoins:Hide()
    playerFrame.player4213WinCoins:Hide()
    -- Insurance Icons
    player4InsuranceYesIcon:Hide()
    player4InsuranceNoIcon:Hide()
    -- Split Buttons & Editboxes
    playerFrame.player4SplitH1Title:Hide()
    playerFrame.player4SplitH2Title:Hide()
    player4SplitH1EditBox:Hide()
    player4SplitH2EditBox:Hide()
    playerFrame.player4HitButtonSplitH1:Hide()
    playerFrame.player4StandButtonSplitH1:Hide()
    playerFrame.player4DoubleButtonSplitH1:Hide()
    playerFrame.player4HitButtonSplitH2:Hide()
    playerFrame.player4StandButtonSplitH2:Hide()
    playerFrame.player4DoubleButtonSplitH2:Hide()
    -- Card Total Text
    playerFrame.player4CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 1, 1)
    -- Card Images / Filenames
    player4MainCardName1 = nil
    player4MainCardName2 = nil
    player4MainCardName3 = nil
    player4MainCardName4 = nil
    player4MainCardName5 = nil
    player4MainCardName6 = nil
    player4MainCardName7 = nil
    player4MainCardFileName1 = nil
    player4MainCardFileName2 = nil
    player4MainCardFileName3 = nil
    player4MainCardFileName4 = nil
    player4MainCardFileName5 = nil
    player4MainCardFileName6 = nil
    player4MainCardFileName7 = nil
    player4H1CardName1 = nil
    player4H1CardName2 = nil
    player4H1CardName3 = nil
    player4H1CardName4 = nil
    player4H1CardName5 = nil
    player4H1CardName6 = nil
    player4H1CardName7 = nil
    player4H1CardFileName1 = nil
    player4H1CardFileName2 = nil
    player4H1CardFileName3 = nil
    player4H1CardFileName4 = nil
    player4H1CardFileName5 = nil
    player4H1CardFileName6 = nil
    player4H1CardFileName7 = nil
    player4H2CardName1 = nil
    player4H2CardName2 = nil
    player4H2CardName3 = nil
    player4H2CardName4 = nil
    player4H2CardName5 = nil
    player4H2CardName6 = nil
    player4H2CardName7 = nil
    player4H2CardFileName1 = nil
    player4H2CardFileName2 = nil
    player4H2CardFileName3 = nil
    player4H2CardFileName4 = nil
    player4H2CardFileName5 = nil
    player4H2CardFileName6 = nil
    player4H2CardFileName7 = nil
    -- Timers
    timerFrame.player4TimerText:SetText("")
    timerFrame.player4TimerText:Hide()
    -- Variables
    player4NumberOfCards = 0
    player4NumberOfCardsH1 = 0
    player4NumberOfCardsH2 = 0
    player4SessionWin = 0
    player4DoubleToggle = false
    player4DoubleHand1Toggle = false
    player4DoubleHand2Toggle = false
    player4SplitToggle = false
    player4PPSideBetWin = false
    player4213SideBetWin = false
    player4Active = false
    player4SessionWinCalled = false

    if player4dealtCardsFrame:IsShown() then
        player4dealtCardsFrame.notStartedYetText:Show()
    end



    -- >>> PLAYER 5 <<<
    -- >>> PLAYER 5 <<<
    -- >>> PLAYER 5 <<<
    
    -- Editboxes / Bets
    if tableLocked == true then
        player5MainBetEditBox:SetText("")
        player5MainBetEditBox:Enable()
        player5PPBetEditBox:SetText("")
        player5PPBetEditBox:Enable()
        player5213BetEditBox:SetText("")
        player5213BetEditBox:Enable()
    else
        player5MainBetEditBox:SetText("")
        player5MainBetEditBox:Enable()
        player5PPBetEditBox:SetText("")
        player5PPBetEditBox:Enable()
        player5213BetEditBox:SetText("")
        player5213BetEditBox:Enable()
        player5ConfirmMainBetButton:Enable()
        player5ConfirmPPBetButton:Enable()
        player5Confirm213BetButton:Enable()
        player5PreloadBetButton:Enable()
    end
    -- Standard Buttons
    if playerName == unitName5 then
        player5MainBetEditBox:Show()
        player5ConfirmMainBetButton:Show()
        playerFrame.player5HitButton:Show()
        playerFrame.player5StandButton:Show()
        playerFrame.player5DoubleButton:Show()
        playerFrame.player5SplitButton:Show()
        playerFrame.player5InsuranceYesButton:Hide()
        playerFrame.player5InsuranceNoButton:Hide()
        playerFrame.player5InsuranceTitle:Hide()
        playerFrame.player5InsuranceSubtitle:Hide()
        playerFrame.player5DealNowButton:Show()
        playerFrame.player5DealNowButton:Disable()
    end
    playerFrame.player5HitButton:Disable()
    playerFrame.player5StandButton:Disable()
    playerFrame.player5DoubleButton:Disable()
    playerFrame.player5SplitButton:Disable()
    playerFrame.player5InsuranceYesButton:Disable()
    playerFrame.player5InsuranceNoButton:Disable()
    -- Bet Amount Labels
    player5MainBetAmount:Hide()
    player5MainBetAmount:SetTextColor(1, 1, 1)
    player5SplitH1BetAmount:Hide()
    player5SplitH1BetAmount:SetTextColor(1, 1, 1)
    player5SplitH2BetAmount:Hide()
    player5SplitH2BetAmount:SetTextColor(1, 1, 1)
    player5PPBetAmount:Hide()
    player5PPBetAmount:SetTextColor(1, 1, 1)
    player5PPBetAmount:SetPoint("CENTER", playerFrame, -328, 154)
    player5213BetAmount:Hide()
    player5213BetAmount:SetTextColor(1, 1, 1)
    player5213BetAmount:SetPoint("CENTER", playerFrame, -263, 56)
    playerFrame.player5InsuranceBetAmount:SetText("")
    playerFrame.player5InsuranceBetAmount:Hide()
    -- Coins Images
    playerFrame.player5MainBetCoins:Hide()
    playerFrame.player5NormalWinCoins:Hide()
    playerFrame.player5SplitHand2Coins:Hide()
    playerFrame.player5SplitHand2DoubleCoins:Hide()
    playerFrame.player5SplitHand2NormalWinCoins:Hide()
    playerFrame.player5SplitHand1Coins:Hide()
    playerFrame.player5SplitHand1DoubleCoins:Hide()
    playerFrame.player5SplitHand1NormalWinCoins:Hide()
    playerFrame.player5BJWinCoins:Hide()
    playerFrame.player5SplitHand2BJWinCoins:Hide()
    playerFrame.player5SplitHand1BJWinCoins:Hide()
    playerFrame.player5DoubleBetCoins:Hide()
    playerFrame.player5PPBetCoins:Hide()
    playerFrame.player5213BetCoins:Hide()
    playerFrame.player5PPWinCoins:Hide()
    playerFrame.player5213WinCoins:Hide()
    -- Insurance Icons
    player5InsuranceYesIcon:Hide()
    player5InsuranceNoIcon:Hide()
    -- Split Buttons & Editboxes
    playerFrame.player5SplitH1Title:Hide()
    playerFrame.player5SplitH2Title:Hide()
    player5SplitH1EditBox:Hide()
    player5SplitH2EditBox:Hide()
    playerFrame.player5HitButtonSplitH1:Hide()
    playerFrame.player5StandButtonSplitH1:Hide()
    playerFrame.player5DoubleButtonSplitH1:Hide()
    playerFrame.player5HitButtonSplitH2:Hide()
    playerFrame.player5StandButtonSplitH2:Hide()
    playerFrame.player5DoubleButtonSplitH2:Hide()
    -- Card Total Text
    playerFrame.player5CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 1, 1)
    playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 1, 1)
    -- Card Images / Filenames
    player5MainCardName1 = nil
    player5MainCardName2 = nil
    player5MainCardName3 = nil
    player5MainCardName4 = nil
    player5MainCardName5 = nil
    player5MainCardName6 = nil
    player5MainCardName7 = nil
    player5MainCardFileName1 = nil
    player5MainCardFileName2 = nil
    player5MainCardFileName3 = nil
    player5MainCardFileName4 = nil
    player5MainCardFileName5 = nil
    player5MainCardFileName6 = nil
    player5MainCardFileName7 = nil
    player5H1CardName1 = nil
    player5H1CardName2 = nil
    player5H1CardName3 = nil
    player5H1CardName4 = nil
    player5H1CardName5 = nil
    player5H1CardName6 = nil
    player5H1CardName7 = nil
    player5H1CardFileName1 = nil
    player5H1CardFileName2 = nil
    player5H1CardFileName3 = nil
    player5H1CardFileName4 = nil
    player5H1CardFileName5 = nil
    player5H1CardFileName6 = nil
    player5H1CardFileName7 = nil
    player5H2CardName1 = nil
    player5H2CardName2 = nil
    player5H2CardName3 = nil
    player5H2CardName4 = nil
    player5H2CardName5 = nil
    player5H2CardName6 = nil
    player5H2CardName7 = nil
    player5H2CardFileName1 = nil
    player5H2CardFileName2 = nil
    player5H2CardFileName3 = nil
    player5H2CardFileName4 = nil
    player5H2CardFileName5 = nil
    player5H2CardFileName6 = nil
    player5H2CardFileName7 = nil
    -- Timers
    timerFrame.player5TimerText:SetText("")
    timerFrame.player5TimerText:Hide()
    -- Variables
    player5NumberOfCards = 0
    player5NumberOfCardsH1 = 0
    player5NumberOfCardsH2 = 0
    player5SessionWin = 0
    player5DoubleToggle = false
    player5DoubleHand1Toggle = false
    player5DoubleHand2Toggle = false
    player5SplitToggle = false
    player5PPSideBetWin = false
    player5213SideBetWin = false
    player5Active = false
    player5SessionWinCalled = false

    if player5dealtCardsFrame:IsShown() then
        player5dealtCardsFrame.notStartedYetText:Show()
    end




    -- >>> DEALER <<<
    -- >>> DEALER <<<
    -- >>> DEALER <<<

    -- Card Total
    playerFrame.dealerCardTotalText:SetTextColor(1, 1, 1)
    -- Card Images / Filenames
    dealerCardName1 = nil
    dealerCardName2 = nil
    dealerCardName3 = nil
    dealerCardName4 = nil
    dealerCardName5 = nil
    dealerCardName6 = nil
    dealerCardName7 = nil
    dealerCardFileName1 = nil
    dealerCardFileName2 = nil
    dealerCardFileName3 = nil
    dealerCardFileName4 = nil
    dealerCardFileName5 = nil
    dealerCardFileName6 = nil
    dealerCardFileName7 = nil
    -- Timers
    timerBetsFrame.timerTextBets:SetText("")
    timerBetsFrame.timerTextBets:Hide()
    timerBetsFrame:Hide()
    timerFrame:Hide()
    countdownDuration = 30
    -- Variables
    turn = 0
    gameRunning = false
    -- "Cards" Frame
    player1dealtCardsFrame.notStartedYetText:Show()
    if player1dealtCardsFrameSplitH1:IsShown() then
        player1dealtCardsFrameSplitH1:Hide()
        player1dealtCardsFrameSplitH1.playerH1CardsButton:Hide()
        player1dealtCardsFrameSplitH1.playerH2CardsButton:Hide()
        player1dealtCardsFrameSplitH2:Hide()
        player1dealtCardsFrameSplitH2.playerH1CardsButton:Hide()
        player1dealtCardsFrameSplitH2.playerH2CardsButton:Hide()
        player1dealtCardsFrame:Show()
        player1dealtCardsFrame.playerCardsButton:Show()
        player1dealtCardsFrame.notStartedYetText:Show()
    elseif player1dealtCardsFrameSplitH2:IsShown() then
        player1dealtCardsFrameSplitH1:Hide()
        player1dealtCardsFrameSplitH1.playerH1CardsButton:Hide()
        player1dealtCardsFrameSplitH2:Hide()
        player1dealtCardsFrameSplitH2.playerH1CardsButton:Hide()
        player1dealtCardsFrameSplitH2.playerH2CardsButton:Hide()
        player1dealtCardsFrame:Show()
        player1dealtCardsFrame.playerCardsButton:Show()
        player1dealtCardsFrame.notStartedYetText:Show()
    end
    -- "sideBetWInFrame"
    sideBetWinFramePP:Hide()
    sideBetWinFrame213:Hide()
    sideBetWinFramePP.title:Hide()
    sideBetWinFrame213.title:Hide()
    sideBetWinFramePP.PPtext:Hide()
    sideBetWinFrame213.t213text:Hide()
    sideBetWinFramePP.MixedPairText:Hide()
    sideBetWinFramePP.ColouredPairText:Hide()
    sideBetWinFramePP.PerfectPairText:Hide()
    sideBetWinFrame213.FlushText:Hide()
    sideBetWinFrame213.StraightText:Hide()
    sideBetWinFrame213.ThreeOfAKindText:Hide()
    sideBetWinFrame213.StraightFlushText:Hide()
    sideBetWinFrame213.SuitedThreeOfAKindText:Hide()
    sideBetWinFramePP.player1PPCardImage1:Hide()
    sideBetWinFramePP.player1PPCardImage2:Hide()
    sideBetWinFrame213.player1213CardImage1:Hide()
    sideBetWinFrame213.player1213CardImage2:Hide()
    sideBetWinFrame213.dealer213CardImage1:Hide()
    sideBetWinFrame213.PlusSymbol:Hide()

    playerFrame.player1TurnArrow:Hide()
    playerFrame.player2TurnArrow:Hide()
    playerFrame.player3TurnArrow:Hide()
    playerFrame.player4TurnArrow:Hide()
    playerFrame.player5TurnArrow:Hide()

end
function forceReload()
    local chatFrame = SELECTED_DOCK_FRAME
    ChatFrame_OpenChat("/reload", chatFrame)
    local editBox = _G[chatFrame:GetName().."EditBox"]
    editBox:Insert("/reload")
end






-- Function to remove card textures
local function RemoveCardTextures()
    for i = 1, #drawnCards do
        drawnCards[i]:Hide() -- Hide the card texture
        drawnCards[i]:SetTexture(nil)  -- Set the texture to nil
    end

    if player1NewCardImage1 then
        player1NewCardImage1:Hide()
    end
    if player1NewCardImage2 then
        player1NewCardImage2:Hide()
    end
    if player2NewCardImage1 then
        player2NewCardImage1:Hide()
    end
    if player2NewCardImage2 then
        player2NewCardImage2:Hide()
    end
    if player3NewCardImage1 then
        player3NewCardImage1:Hide()
    end
    if player3NewCardImage2 then
        player3NewCardImage2:Hide()
    end
    if player4NewCardImage1 then
        player4NewCardImage1:Hide()
    end
    if player4NewCardImage2 then
        player4NewCardImage2:Hide()
    end
    if player5NewCardImage1 then
        player5NewCardImage1:Hide()
    end
    if player5NewCardImage2 then
        player5NewCardImage2:Hide()
    end

    drawnCards = {} -- Reset the table of card textures
    dealtCards = {}

    playerFrame.player1CardTotalText:Hide()
    playerFrame.player1SplitHand1CardTotalText:Hide()
    playerFrame.player1SplitHand2CardTotalText:Hide()
    playerFrame.player2CardTotalText:Hide()
    playerFrame.player2SplitHand1CardTotalText:Hide()
    playerFrame.player2SplitHand2CardTotalText:Hide()
    playerFrame.player3CardTotalText:Hide()
    playerFrame.player3SplitHand1CardTotalText:Hide()
    playerFrame.player3SplitHand2CardTotalText:Hide()
    playerFrame.player4CardTotalText:Hide()
    playerFrame.player4SplitHand1CardTotalText:Hide()
    playerFrame.player4SplitHand2CardTotalText:Hide()
    playerFrame.player5CardTotalText:Hide()
    playerFrame.player5SplitHand1CardTotalText:Hide()
    playerFrame.player5SplitHand2CardTotalText:Hide()
    playerFrame.dealerCardTotalText:Hide()

    playerFrame.player1CardTotalText:SetText("")
    playerFrame.player1SplitHand1CardTotalText:SetText("")
    playerFrame.player1SplitHand2CardTotalText:SetText("")
    playerFrame.player2CardTotalText:SetText("")
    playerFrame.player2SplitHand1CardTotalText:SetText("")
    playerFrame.player2SplitHand2CardTotalText:SetText("")
    playerFrame.player3CardTotalText:SetText("")
    playerFrame.player3SplitHand1CardTotalText:SetText("")
    playerFrame.player3SplitHand2CardTotalText:SetText("")
    playerFrame.player4CardTotalText:SetText("")
    playerFrame.player4SplitHand1CardTotalText:SetText("")
    playerFrame.player4SplitHand2CardTotalText:SetText("")
    playerFrame.player5CardTotalText:SetText("")
    playerFrame.player5SplitHand1CardTotalText:SetText("")
    playerFrame.player5SplitHand2CardTotalText:SetText("")

    -- Reset Dealt Cards Frame
    player1dealtCardsFrame.player1MainCardImage1:Hide()
    player1dealtCardsFrame.playerFirstCardText:Hide()
    player1dealtCardsFrame.player1MainCardImage2:Hide()
    player1dealtCardsFrame.playerSecondCardText:Hide()
    player1dealtCardsFrame.player1MainCardImage3:Hide()
    player1dealtCardsFrame.playerThirdCardText:Hide()
    player1dealtCardsFrame.player1MainCardImage4:Hide()
    player1dealtCardsFrame.playerFourthCardText:Hide()
    player1dealtCardsFrame.player1MainCardImage5:Hide()
    player1dealtCardsFrame.playerFifthCardText:Hide()
    player1dealtCardsFrame.player1MainCardImage6:Hide()
    player1dealtCardsFrame.playerSixthCardText:Hide()
    player1dealtCardsFrame.player1MainCardImage7:Hide()
    player1dealtCardsFrame.playerSeventhCardText:Hide()

    player1dealtCardsFrameSplitH1.player1H1CardImage1:Hide()
    player1dealtCardsFrameSplitH1.playerFirstCardText:Hide()
    player1dealtCardsFrameSplitH1.player1H1CardImage2:Hide()
    player1dealtCardsFrameSplitH1.playerSecondCardText:Hide()
    player1dealtCardsFrameSplitH1.player1H1CardImage3:Hide()
    player1dealtCardsFrameSplitH1.playerThirdCardText:Hide()
    player1dealtCardsFrameSplitH1.player1H1CardImage4:Hide()
    player1dealtCardsFrameSplitH1.playerFourthCardText:Hide()
    player1dealtCardsFrameSplitH1.player1H1CardImage5:Hide()
    player1dealtCardsFrameSplitH1.playerFifthCardText:Hide()
    player1dealtCardsFrameSplitH1.player1H1CardImage6:Hide()
    player1dealtCardsFrameSplitH1.playerSixthCardText:Hide()
    player1dealtCardsFrameSplitH1.player1H1CardImage7:Hide()
    player1dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

    player1dealtCardsFrameSplitH2.player1H2CardImage1:Hide()
    player1dealtCardsFrameSplitH2.playerFirstCardText:Hide()
    player1dealtCardsFrameSplitH2.player1H2CardImage2:Hide()
    player1dealtCardsFrameSplitH2.playerSecondCardText:Hide()
    player1dealtCardsFrameSplitH2.player1H2CardImage3:Hide()
    player1dealtCardsFrameSplitH2.playerThirdCardText:Hide()
    player1dealtCardsFrameSplitH2.player1H2CardImage4:Hide()
    player1dealtCardsFrameSplitH2.playerFourthCardText:Hide()
    player1dealtCardsFrameSplitH2.player1H2CardImage5:Hide()
    player1dealtCardsFrameSplitH2.playerFifthCardText:Hide()
    player1dealtCardsFrameSplitH2.player1H2CardImage6:Hide()
    player1dealtCardsFrameSplitH2.playerSixthCardText:Hide()
    player1dealtCardsFrameSplitH2.player1H2CardImage7:Hide()
    player1dealtCardsFrameSplitH2.playerSeventhCardText:Hide()

    player2dealtCardsFrame.player2MainCardImage1:Hide()
    player2dealtCardsFrame.playerFirstCardText:Hide()
    player2dealtCardsFrame.player2MainCardImage2:Hide()
    player2dealtCardsFrame.playerSecondCardText:Hide()
    player2dealtCardsFrame.player2MainCardImage3:Hide()
    player2dealtCardsFrame.playerThirdCardText:Hide()
    player2dealtCardsFrame.player2MainCardImage4:Hide()
    player2dealtCardsFrame.playerFourthCardText:Hide()
    player2dealtCardsFrame.player2MainCardImage5:Hide()
    player2dealtCardsFrame.playerFifthCardText:Hide()
    player2dealtCardsFrame.player2MainCardImage6:Hide()
    player2dealtCardsFrame.playerSixthCardText:Hide()
    player2dealtCardsFrame.player2MainCardImage7:Hide()
    player2dealtCardsFrame.playerSeventhCardText:Hide()

    player2dealtCardsFrameSplitH1.player2H1CardImage1:Hide()
    player2dealtCardsFrameSplitH1.playerFirstCardText:Hide()
    player2dealtCardsFrameSplitH1.player2H1CardImage2:Hide()
    player2dealtCardsFrameSplitH1.playerSecondCardText:Hide()
    player2dealtCardsFrameSplitH1.player2H1CardImage3:Hide()
    player2dealtCardsFrameSplitH1.playerThirdCardText:Hide()
    player2dealtCardsFrameSplitH1.player2H1CardImage4:Hide()
    player2dealtCardsFrameSplitH1.playerFourthCardText:Hide()
    player2dealtCardsFrameSplitH1.player2H1CardImage5:Hide()
    player2dealtCardsFrameSplitH1.playerFifthCardText:Hide()
    player2dealtCardsFrameSplitH1.player2H1CardImage6:Hide()
    player2dealtCardsFrameSplitH1.playerSixthCardText:Hide()
    player2dealtCardsFrameSplitH1.player2H1CardImage7:Hide()
    player2dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

    player2dealtCardsFrameSplitH2.player2H2CardImage1:Hide()
    player2dealtCardsFrameSplitH2.playerFirstCardText:Hide()
    player2dealtCardsFrameSplitH2.player2H2CardImage2:Hide()
    player2dealtCardsFrameSplitH2.playerSecondCardText:Hide()
    player2dealtCardsFrameSplitH2.player2H2CardImage3:Hide()
    player2dealtCardsFrameSplitH2.playerThirdCardText:Hide()
    player2dealtCardsFrameSplitH2.player2H2CardImage4:Hide()
    player2dealtCardsFrameSplitH2.playerFourthCardText:Hide()
    player2dealtCardsFrameSplitH2.player2H2CardImage5:Hide()
    player2dealtCardsFrameSplitH2.playerFifthCardText:Hide()
    player2dealtCardsFrameSplitH2.player2H2CardImage6:Hide()
    player2dealtCardsFrameSplitH2.playerSixthCardText:Hide()
    player2dealtCardsFrameSplitH2.player2H2CardImage7:Hide()
    player2dealtCardsFrameSplitH2.playerSeventhCardText:Hide()

    player3dealtCardsFrame.player3MainCardImage1:Hide()
    player3dealtCardsFrame.playerFirstCardText:Hide()
    player3dealtCardsFrame.player3MainCardImage2:Hide()
    player3dealtCardsFrame.playerSecondCardText:Hide()
    player3dealtCardsFrame.player3MainCardImage3:Hide()
    player3dealtCardsFrame.playerThirdCardText:Hide()
    player3dealtCardsFrame.player3MainCardImage4:Hide()
    player3dealtCardsFrame.playerFourthCardText:Hide()
    player3dealtCardsFrame.player3MainCardImage5:Hide()
    player3dealtCardsFrame.playerFifthCardText:Hide()
    player3dealtCardsFrame.player3MainCardImage6:Hide()
    player3dealtCardsFrame.playerSixthCardText:Hide()
    player3dealtCardsFrame.player3MainCardImage7:Hide()
    player3dealtCardsFrame.playerSeventhCardText:Hide()

    player3dealtCardsFrameSplitH1.player3H1CardImage1:Hide()
    player3dealtCardsFrameSplitH1.playerFirstCardText:Hide()
    player3dealtCardsFrameSplitH1.player3H1CardImage2:Hide()
    player3dealtCardsFrameSplitH1.playerSecondCardText:Hide()
    player3dealtCardsFrameSplitH1.player3H1CardImage3:Hide()
    player3dealtCardsFrameSplitH1.playerThirdCardText:Hide()
    player3dealtCardsFrameSplitH1.player3H1CardImage4:Hide()
    player3dealtCardsFrameSplitH1.playerFourthCardText:Hide()
    player3dealtCardsFrameSplitH1.player3H1CardImage5:Hide()
    player3dealtCardsFrameSplitH1.playerFifthCardText:Hide()
    player3dealtCardsFrameSplitH1.player3H1CardImage6:Hide()
    player3dealtCardsFrameSplitH1.playerSixthCardText:Hide()
    player3dealtCardsFrameSplitH1.player3H1CardImage7:Hide()
    player3dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

    player3dealtCardsFrameSplitH2.player3H2CardImage1:Hide()
    player3dealtCardsFrameSplitH2.playerFirstCardText:Hide()
    player3dealtCardsFrameSplitH2.player3H2CardImage2:Hide()
    player3dealtCardsFrameSplitH2.playerSecondCardText:Hide()
    player3dealtCardsFrameSplitH2.player3H2CardImage3:Hide()
    player3dealtCardsFrameSplitH2.playerThirdCardText:Hide()
    player3dealtCardsFrameSplitH2.player3H2CardImage4:Hide()
    player3dealtCardsFrameSplitH2.playerFourthCardText:Hide()
    player3dealtCardsFrameSplitH2.player3H2CardImage5:Hide()
    player3dealtCardsFrameSplitH2.playerFifthCardText:Hide()
    player3dealtCardsFrameSplitH2.player3H2CardImage6:Hide()
    player3dealtCardsFrameSplitH2.playerSixthCardText:Hide()
    player3dealtCardsFrameSplitH2.player3H2CardImage7:Hide()
    player3dealtCardsFrameSplitH2.playerSeventhCardText:Hide()

    player4dealtCardsFrame.player4MainCardImage1:Hide()
    player4dealtCardsFrame.playerFirstCardText:Hide()
    player4dealtCardsFrame.player4MainCardImage2:Hide()
    player4dealtCardsFrame.playerSecondCardText:Hide()
    player4dealtCardsFrame.player4MainCardImage3:Hide()
    player4dealtCardsFrame.playerThirdCardText:Hide()
    player4dealtCardsFrame.player4MainCardImage4:Hide()
    player4dealtCardsFrame.playerFourthCardText:Hide()
    player4dealtCardsFrame.player4MainCardImage5:Hide()
    player4dealtCardsFrame.playerFifthCardText:Hide()
    player4dealtCardsFrame.player4MainCardImage6:Hide()
    player4dealtCardsFrame.playerSixthCardText:Hide()
    player4dealtCardsFrame.player4MainCardImage7:Hide()
    player4dealtCardsFrame.playerSeventhCardText:Hide()

    player4dealtCardsFrameSplitH1.player4H1CardImage1:Hide()
    player4dealtCardsFrameSplitH1.playerFirstCardText:Hide()
    player4dealtCardsFrameSplitH1.player4H1CardImage2:Hide()
    player4dealtCardsFrameSplitH1.playerSecondCardText:Hide()
    player4dealtCardsFrameSplitH1.player4H1CardImage3:Hide()
    player4dealtCardsFrameSplitH1.playerThirdCardText:Hide()
    player4dealtCardsFrameSplitH1.player4H1CardImage4:Hide()
    player4dealtCardsFrameSplitH1.playerFourthCardText:Hide()
    player4dealtCardsFrameSplitH1.player4H1CardImage5:Hide()
    player4dealtCardsFrameSplitH1.playerFifthCardText:Hide()
    player4dealtCardsFrameSplitH1.player4H1CardImage6:Hide()
    player4dealtCardsFrameSplitH1.playerSixthCardText:Hide()
    player4dealtCardsFrameSplitH1.player4H1CardImage7:Hide()
    player4dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

    player4dealtCardsFrameSplitH2.player4H2CardImage1:Hide()
    player4dealtCardsFrameSplitH2.playerFirstCardText:Hide()
    player4dealtCardsFrameSplitH2.player4H2CardImage2:Hide()
    player4dealtCardsFrameSplitH2.playerSecondCardText:Hide()
    player4dealtCardsFrameSplitH2.player4H2CardImage3:Hide()
    player4dealtCardsFrameSplitH2.playerThirdCardText:Hide()
    player4dealtCardsFrameSplitH2.player4H2CardImage4:Hide()
    player4dealtCardsFrameSplitH2.playerFourthCardText:Hide()
    player4dealtCardsFrameSplitH2.player4H2CardImage5:Hide()
    player4dealtCardsFrameSplitH2.playerFifthCardText:Hide()
    player4dealtCardsFrameSplitH2.player4H2CardImage6:Hide()
    player4dealtCardsFrameSplitH2.playerSixthCardText:Hide()
    player4dealtCardsFrameSplitH2.player4H2CardImage7:Hide()
    player4dealtCardsFrameSplitH2.playerSeventhCardText:Hide()

    player5dealtCardsFrame.player5MainCardImage1:Hide()
    player5dealtCardsFrame.playerFirstCardText:Hide()
    player5dealtCardsFrame.player5MainCardImage2:Hide()
    player5dealtCardsFrame.playerSecondCardText:Hide()
    player5dealtCardsFrame.player5MainCardImage3:Hide()
    player5dealtCardsFrame.playerThirdCardText:Hide()
    player5dealtCardsFrame.player5MainCardImage4:Hide()
    player5dealtCardsFrame.playerFourthCardText:Hide()
    player5dealtCardsFrame.player5MainCardImage5:Hide()
    player5dealtCardsFrame.playerFifthCardText:Hide()
    player5dealtCardsFrame.player5MainCardImage6:Hide()
    player5dealtCardsFrame.playerSixthCardText:Hide()
    player5dealtCardsFrame.player5MainCardImage7:Hide()
    player5dealtCardsFrame.playerSeventhCardText:Hide()

    player5dealtCardsFrameSplitH1.player5H1CardImage1:Hide()
    player5dealtCardsFrameSplitH1.playerFirstCardText:Hide()
    player5dealtCardsFrameSplitH1.player5H1CardImage2:Hide()
    player5dealtCardsFrameSplitH1.playerSecondCardText:Hide()
    player5dealtCardsFrameSplitH1.player5H1CardImage3:Hide()
    player5dealtCardsFrameSplitH1.playerThirdCardText:Hide()
    player5dealtCardsFrameSplitH1.player5H1CardImage4:Hide()
    player5dealtCardsFrameSplitH1.playerFourthCardText:Hide()
    player5dealtCardsFrameSplitH1.player5H1CardImage5:Hide()
    player5dealtCardsFrameSplitH1.playerFifthCardText:Hide()
    player5dealtCardsFrameSplitH1.player5H1CardImage6:Hide()
    player5dealtCardsFrameSplitH1.playerSixthCardText:Hide()
    player5dealtCardsFrameSplitH1.player5H1CardImage7:Hide()
    player5dealtCardsFrameSplitH1.playerSeventhCardText:Hide()

    player5dealtCardsFrameSplitH2.player5H2CardImage1:Hide()
    player5dealtCardsFrameSplitH2.playerFirstCardText:Hide()
    player5dealtCardsFrameSplitH2.player5H2CardImage2:Hide()
    player5dealtCardsFrameSplitH2.playerSecondCardText:Hide()
    player5dealtCardsFrameSplitH2.player5H2CardImage3:Hide()
    player5dealtCardsFrameSplitH2.playerThirdCardText:Hide()
    player5dealtCardsFrameSplitH2.player5H2CardImage4:Hide()
    player5dealtCardsFrameSplitH2.playerFourthCardText:Hide()
    player5dealtCardsFrameSplitH2.player5H2CardImage5:Hide()
    player5dealtCardsFrameSplitH2.playerFifthCardText:Hide()
    player5dealtCardsFrameSplitH2.player5H2CardImage6:Hide()
    player5dealtCardsFrameSplitH2.playerSixthCardText:Hide()
    player5dealtCardsFrameSplitH2.player5H2CardImage7:Hide()
    player5dealtCardsFrameSplitH2.playerSeventhCardText:Hide()

    -- Reset DealerTotal
    playerFrame.dealerCardTotalText:SetText("")
end
-- Function to get the card image file name from the card name
local function GetCardFileName(cardName)
    for fileName, name in pairs(cardNames) do
        if name == cardName then
            return fileName
        end
    end
end








-- Event register for raid chat messages
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("CHAT_MSG_RAID")
eventFrame:SetScript("OnEvent", function(self, event, message, sender)

    local AceValues = {
        ["1 or 11"] = "11",
        ["2 or 12"] = "12",
        ["3 or 13"] = "13",
        ["4 or 14"] = "14",
        ["5 or 15"] = "15",
        ["6 or 16"] = "16",
        ["7 or 17"] = "17",
        ["8 or 18"] = "18",
        ["9 or 19"] = "19",
        ["10 or 20"] = "20"
    }

    player1BeforeStandValue = playerFrame.player1CardTotalText:GetText()
    player1AfterStandValue = AceValues[player1BeforeStandValue]
    player1SplitHand1BeforeStandValue = playerFrame.player1SplitHand1CardTotalText:GetText()
    player1SplitHand1AfterStandValue = AceValues[player1SplitHand1BeforeStandValue]
    player1SplitHand2BeforeStandValue = playerFrame.player1SplitHand2CardTotalText:GetText()
    player1SplitHand2AfterStandValue = AceValues[player1SplitHand2BeforeStandValue]

    player2BeforeStandValue = playerFrame.player2CardTotalText:GetText()
    player2AfterStandValue = AceValues[player2BeforeStandValue]
    player2SplitHand1BeforeStandValue = playerFrame.player2SplitHand1CardTotalText:GetText()
    player2SplitHand1AfterStandValue = AceValues[player2SplitHand1BeforeStandValue]
    player2SplitHand2BeforeStandValue = playerFrame.player2SplitHand2CardTotalText:GetText()
    player2SplitHand2AfterStandValue = AceValues[player2SplitHand2BeforeStandValue]

    player3BeforeStandValue = playerFrame.player3CardTotalText:GetText()
    player3AfterStandValue = AceValues[player3BeforeStandValue]
    player3SplitHand1BeforeStandValue = playerFrame.player3SplitHand1CardTotalText:GetText()
    player3SplitHand1AfterStandValue = AceValues[player3SplitHand1BeforeStandValue]
    player3SplitHand2BeforeStandValue = playerFrame.player3SplitHand2CardTotalText:GetText()
    player3SplitHand2AfterStandValue = AceValues[player3SplitHand2BeforeStandValue]

    player4BeforeStandValue = playerFrame.player4CardTotalText:GetText()
    player4AfterStandValue = AceValues[player4BeforeStandValue]
    player4SplitHand1BeforeStandValue = playerFrame.player4SplitHand1CardTotalText:GetText()
    player4SplitHand1AfterStandValue = AceValues[player4SplitHand1BeforeStandValue]
    player4SplitHand2BeforeStandValue = playerFrame.player4SplitHand2CardTotalText:GetText()
    player4SplitHand2AfterStandValue = AceValues[player4SplitHand2BeforeStandValue]

    player5BeforeStandValue = playerFrame.player5CardTotalText:GetText()
    player5AfterStandValue = AceValues[player5BeforeStandValue]
    player5SplitHand1BeforeStandValue = playerFrame.player5SplitHand1CardTotalText:GetText()
    player5SplitHand1AfterStandValue = AceValues[player5SplitHand1BeforeStandValue]
    player5SplitHand2BeforeStandValue = playerFrame.player5SplitHand2CardTotalText:GetText()
    player5SplitHand2AfterStandValue = AceValues[player5SplitHand2BeforeStandValue]

    if string.find(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+1%.?") then
        player1Name = string.match(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+1%.?")
        unitName1 = player1Name
        if unitName1 == unitName2 then
            unitName2 = nil
        elseif unitName1 == unitName3 then
            unitName3 = nil
        elseif unitName1 == unitName4 then
            unitName4 = nil
        elseif unitName1 == unitName5 then
            unitName5 = nil
        end
        playerFrame.player1Name:SetText(player1Name)
        playerFrame.takeSeat1Button:Disable()

        -- If the player has banking information stored, retrieve it
        if playerBankingInfo[player1Name] then
            local bankingInfo = playerBankingInfo[player1Name]
            player1BankingTotalWagered = bankingInfo.totalWagered
            historyFrame.player1totalWageredAmount:SetText(player1BankingTotalWagered .. " G")
            player1BankingTotalWon = bankingInfo.totalWon
            historyFrame.player1totalWonAmount:SetText(player1BankingTotalWon .. " G")
            player1BankingTotalLost = bankingInfo.totalLost
            historyFrame.player1totalLostAmount:SetText(player1BankingTotalLost .. " G")
            player1BankingTotalProfit = bankingInfo.totalProfit
            historyFrame.player1ProfitAmount:SetText(player1BankingTotalProfit .. " G")
            if player1BankingTotalProfit > 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            elseif player1BankingTotalProfit == 0 then
                historyFrame.player1ProfitAmount:SetTextColor(1, 1, 1)
            elseif player1BankingTotalProfit < 0 then
                historyFrame.player1ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
            player1BankingBankrollTable = bankingInfo.bankrollTable
            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1BankingBankrollTable .. " G")
            player1BankingBankrollCashDesk = bankingInfo.bankrollCashDesk
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1BankingBankrollCashDesk .. " G")
        
        else
            -- Initialize banking information if not found
            player1totalBetAmount = 0
            player1totalWin = 0
            player1totalLoss = 0
            player1totalProfit = 0
            player1TotalBankrollAmount = 0
        end
    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+left%s+Seat%s+1%.?") then
        playerFrame.player1Name:SetText("Seat Empty")
        if playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
            playerFrame.takeSeat1Button:Disable()
        else
            playerFrame.takeSeat1Button:Enable()
        end

        player1Hotstreak = 0
        player1HotstreakImage1:Hide()
        player1HotstreakImage2:Hide()
        player1HotstreakImage3:Hide()
        player1HotstreakImage4:Hide()
        player1HotstreakImage5:Hide()
        player1HotstreakImage6:Hide()
        player1HotstreakImage7:Hide()
        player1HotstreakImage8:Hide()
        player1HotstreakImage9:Hide()
        player1HotstreakImage10:Hide()
        player1HotstreakImage11:Hide()
        player1HotstreakImage12:Hide()
        player1HotstreakImage13:Hide()
        player1HotstreakImage14:Hide()
        player1HotstreakImage15:Hide()

        historyFrame.player1totalWageredAmount:SetText("0 G")
        historyFrame.player1totalWonAmount:SetText("0 G")
        historyFrame.player1totalLostAmount:SetText("0 G")
        historyFrame.player1ProfitAmount:SetText("0 G")
        historyFrame.player1ProfitAmount:SetTextColor(1, 1, 1)

        player1totalBetAmount = 0
        player1totalWin = 0
        player1totalLoss = 0
        player1totalProfit = 0
        player1TotalBankrollAmount = 0

        -- Reset banking information for the leaving player
        unitName1 = nil
        player1Name = nil
    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+2%.?") then
        player2Name = string.match(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+2%.?")
        unitName2 = player2Name
        if unitName2 == unitName1 then
            unitName1 = nil
        elseif unitName2 == unitName3 then
            unitName3 = nil
        elseif unitName2 == unitName4 then
            unitName4 = nil
        elseif unitName2 == unitName5 then
            unitName5 = nil
        end
        playerFrame.player2Name:SetText(player2Name)
        playerFrame.takeSeat2Button:Disable()

        -- If the player has banking information stored, retrieve it
        if playerBankingInfo[player2Name] then
            local bankingInfo = playerBankingInfo[player2Name]
            player2BankingTotalWagered = bankingInfo.totalWagered
            historyFrame.player2totalWageredAmount:SetText(player2BankingTotalWagered .. " G")
            player2BankingTotalWon = bankingInfo.totalWon
            historyFrame.player2totalWonAmount:SetText(player2BankingTotalWon .. " G")
            player2BankingTotalLost = bankingInfo.totalLost
            historyFrame.player2totalLostAmount:SetText(player2BankingTotalLost .. " G")
            player2BankingTotalProfit = bankingInfo.totalProfit
            historyFrame.player2ProfitAmount:SetText(player2BankingTotalProfit .. " G")
            if player2BankingTotalProfit > 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            elseif player2BankingTotalProfit == 0 then
                historyFrame.player2ProfitAmount:SetTextColor(1, 1, 1)
            elseif player2BankingTotalProfit < 0 then
                historyFrame.player2ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
            player2BankingBankrollTable = bankingInfo.bankrollTable
            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2BankingBankrollTable .. " G")
            player2BankingBankrollCashDesk = bankingInfo.bankrollCashDesk
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2BankingBankrollCashDesk .. " G")
        else
            -- Initialize banking information if not found
            player2totalBetAmount = 0
            player2totalWin = 0
            player2totalLoss = 0
            player2totalProfit = 0
            player2TotalBankrollAmount = 0
        end
    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+left%s+Seat%s+2%.?") then
        playerFrame.player2Name:SetText("Seat Empty")
        if playerFrame.player1HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
            playerFrame.takeSeat2Button:Disable()
        else
            playerFrame.takeSeat2Button:Enable()
        end

        player2Hotstreak = 0
        player2HotstreakImage1:Hide()
        player2HotstreakImage2:Hide()
        player2HotstreakImage3:Hide()
        player2HotstreakImage4:Hide()
        player2HotstreakImage5:Hide()
        player2HotstreakImage6:Hide()
        player2HotstreakImage7:Hide()
        player2HotstreakImage8:Hide()
        player2HotstreakImage9:Hide()
        player2HotstreakImage10:Hide()
        player2HotstreakImage11:Hide()
        player2HotstreakImage12:Hide()
        player2HotstreakImage13:Hide()
        player2HotstreakImage14:Hide()
        player2HotstreakImage15:Hide()

        local wageredString = historyFrame.player2totalWageredAmount:GetText()
        local wonString = historyFrame.player2totalWonAmount:GetText()
        local lostString = historyFrame.player2totalLostAmount:GetText()
        local profitString = historyFrame.player2ProfitAmount:GetText()
        local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()

        local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
        local wonAmount = tonumber(string.match(wonString, "(%d+)"))
        local lostAmount = tonumber(string.match(lostString, "(%d+)"))
        local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
        local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

        -- Store banking information for the leaving player
        if wageredAmount then
            playerBankingInfo[player2Name] = {
                totalWagered = wageredAmount,
                totalWon = wonAmount,
                totalLost = lostAmount,
                totalProfit = profitAmount,
                bankrollTable = bankrollAmount,
                bankrollCashDesk = bankrollAmount
            }
        end

        historyFrame.player2totalWageredAmount:SetText("0 G")
        historyFrame.player2totalWonAmount:SetText("0 G")
        historyFrame.player2totalLostAmount:SetText("0 G")
        historyFrame.player2ProfitAmount:SetText("0 G")
        historyFrame.player2ProfitAmount:SetTextColor(1, 1, 1)

        player2totalBetAmount = 0
        player2totalWin = 0
        player2totalLoss = 0
        player2totalProfit = 0
        player2TotalBankrollAmount = 0

        -- Reset banking information for the leaving player
        unitName2 = nil
        player2Name = nil

    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+3%.?") then
        player3Name = string.match(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+3%.?")
        unitName3 = player3Name
        if unitName3 == unitName1 then
            unitName1 = nil
        elseif unitName3 == unitName2 then
            unitName2 = nil
        elseif unitName3 == unitName4 then
            unitName4 = nil
        elseif unitName3 == unitName5 then
            unitName5 = nil
        end
        playerFrame.player3Name:SetText(player3Name)
        playerFrame.takeSeat3Button:Disable()

        -- If the player has banking information stored, retrieve it
        if playerBankingInfo[player3Name] then
            local bankingInfo = playerBankingInfo[player3Name]
            player3BankingTotalWagered = bankingInfo.totalWagered
            historyFrame.player3totalWageredAmount:SetText(player3BankingTotalWagered .. " G")
            player3BankingTotalWon = bankingInfo.totalWon
            historyFrame.player3totalWonAmount:SetText(player3BankingTotalWon .. " G")
            player3BankingTotalLost = bankingInfo.totalLost
            historyFrame.player3totalLostAmount:SetText(player3BankingTotalLost .. " G")
            player3BankingTotalProfit = bankingInfo.totalProfit
            historyFrame.player3ProfitAmount:SetText(player3BankingTotalProfit .. " G")
            if player3BankingTotalProfit > 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            elseif player3BankingTotalProfit == 0 then
                historyFrame.player3ProfitAmount:SetTextColor(1, 1, 1)
            elseif player3BankingTotalProfit < 0 then
                historyFrame.player3ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
            player3BankingBankrollTable = bankingInfo.bankrollTable
            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3BankingBankrollTable .. " G")
            player3BankingBankrollCashDesk = bankingInfo.bankrollCashDesk
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3BankingBankrollCashDesk .. " G")
        else
            -- Initialize banking information if not found
            player3totalBetAmount = 0
            player3totalWin = 0
            player3totalLoss = 0
            player3totalProfit = 0
            player3TotalBankrollAmount = 0
        end
    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+left%s+Seat%s+3%.?") then
        playerFrame.player3Name:SetText("Seat Empty")
        if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
            playerFrame.takeSeat3Button:Disable()
        else
            playerFrame.takeSeat3Button:Enable()
        end

        player3Hotstreak = 0
        player3HotstreakImage1:Hide()
        player3HotstreakImage2:Hide()
        player3HotstreakImage3:Hide()
        player3HotstreakImage4:Hide()
        player3HotstreakImage5:Hide()
        player3HotstreakImage6:Hide()
        player3HotstreakImage7:Hide()
        player3HotstreakImage8:Hide()
        player3HotstreakImage9:Hide()
        player3HotstreakImage10:Hide()
        player3HotstreakImage11:Hide()
        player3HotstreakImage12:Hide()
        player3HotstreakImage13:Hide()
        player3HotstreakImage14:Hide()
        player3HotstreakImage15:Hide()

        local wageredString = historyFrame.player3totalWageredAmount:GetText()
        local wonString = historyFrame.player3totalWonAmount:GetText()
        local lostString = historyFrame.player3totalLostAmount:GetText()
        local profitString = historyFrame.player3ProfitAmount:GetText()
        local bankrollString = bankrollFrame.player3TotalBankrollTableDisplay:GetText()

        local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
        local wonAmount = tonumber(string.match(wonString, "(%d+)"))
        local lostAmount = tonumber(string.match(lostString, "(%d+)"))
        local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
        local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

        -- Store banking information for the leaving player
        if wageredAmount then
            playerBankingInfo[player3Name] = {
                totalWagered = wageredAmount,
                totalWon = wonAmount,
                totalLost = lostAmount,
                totalProfit = profitAmount,
                bankrollTable = bankrollAmount,
                bankrollCashDesk = bankrollAmount
            }
        end

        historyFrame.player3totalWageredAmount:SetText("0 G")
        historyFrame.player3totalWonAmount:SetText("0 G")
        historyFrame.player3totalLostAmount:SetText("0 G")
        historyFrame.player3ProfitAmount:SetText("0 G")
        historyFrame.player3ProfitAmount:SetTextColor(1, 1, 1)

        player3totalBetAmount = 0
        player32totalWin = 0
        player3totalLoss = 0
        player3totalProfit = 0
        player3TotalBankrollAmount = 0

        -- Reset banking information for the leaving player
        unitName3 = nil
        player3Name = nil

    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+4%.?") then
        player4Name = string.match(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+4%.?")
        unitName4 = player4Name
        if unitName4 == unitName1 then
            unitName1 = nil
        elseif unitName4 == unitName2 then
            unitName2 = nil
        elseif unitName4 == unitName3 then
            unitName3 = nil
        elseif unitName4 == unitName5 then
            unitName5 = nil
        end
        playerFrame.player4Name:SetText(player4Name)
        playerFrame.takeSeat4Button:Disable()

        -- If the player has banking information stored, retrieve it
        if playerBankingInfo[player4Name] then
            local bankingInfo = playerBankingInfo[player4Name]
            player4BankingTotalWagered = bankingInfo.totalWagered
            historyFrame.player4totalWageredAmount:SetText(player4BankingTotalWagered .. " G")
            player4BankingTotalWon = bankingInfo.totalWon
            historyFrame.player4totalWonAmount:SetText(player4BankingTotalWon .. " G")
            player4BankingTotalLost = bankingInfo.totalLost
            historyFrame.player4totalLostAmount:SetText(player4BankingTotalLost .. " G")
            player4BankingTotalProfit = bankingInfo.totalProfit
            historyFrame.player4ProfitAmount:SetText(player4BankingTotalProfit .. " G")
            if player4BankingTotalProfit > 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            elseif player4BankingTotalProfit == 0 then
                historyFrame.player4ProfitAmount:SetTextColor(1, 1, 1)
            elseif player4BankingTotalProfit < 0 then
                historyFrame.player4ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
            player4BankingBankrollTable = bankingInfo.bankrollTable
            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4BankingBankrollTable .. " G")
            player4BankingBankrollCashDesk = bankingInfo.bankrollCashDesk
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4BankingBankrollCashDesk .. " G")
        else
            -- Initialize banking information if not found
            player4totalBetAmount = 0
            player4totalWin = 0
            player4totalLoss = 0
            player4totalProfit = 0
            player4TotalBankrollAmount = 0
        end
    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+left%s+Seat%s+4%.?") then
        playerFrame.player4Name:SetText("Seat Empty")
        if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
            playerFrame.takeSeat4Button:Disable()
        else
            playerFrame.takeSeat4Button:Enable()
        end

        player4Hotstreak = 0
        player4HotstreakImage1:Hide()
        player4HotstreakImage2:Hide()
        player4HotstreakImage3:Hide()
        player4HotstreakImage4:Hide()
        player4HotstreakImage5:Hide()
        player4HotstreakImage6:Hide()
        player4HotstreakImage7:Hide()
        player4HotstreakImage8:Hide()
        player4HotstreakImage9:Hide()
        player4HotstreakImage10:Hide()
        player4HotstreakImage11:Hide()
        player4HotstreakImage12:Hide()
        player4HotstreakImage13:Hide()
        player4HotstreakImage14:Hide()
        player4HotstreakImage15:Hide()

        local wageredString = historyFrame.player4totalWageredAmount:GetText()
        local wonString = historyFrame.player4totalWonAmount:GetText()
        local lostString = historyFrame.player4totalLostAmount:GetText()
        local profitString = historyFrame.player4ProfitAmount:GetText()
        local bankrollString = bankrollFrame.player4TotalBankrollTableDisplay:GetText()

        local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
        local wonAmount = tonumber(string.match(wonString, "(%d+)"))
        local lostAmount = tonumber(string.match(lostString, "(%d+)"))
        local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
        local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

        -- Store banking information for the leaving player
        if wageredAmount then
            playerBankingInfo[player4Name] = {
                totalWagered = wageredAmount,
                totalWon = wonAmount,
                totalLost = lostAmount,
                totalProfit = profitAmount,
                bankrollTable = bankrollAmount,
                bankrollCashDesk = bankrollAmount
            }
        end

        historyFrame.player4totalWageredAmount:SetText("0 G")
        historyFrame.player4totalWonAmount:SetText("0 G")
        historyFrame.player4totalLostAmount:SetText("0 G")
        historyFrame.player4ProfitAmount:SetText("0 G")
        historyFrame.player4ProfitAmount:SetTextColor(1, 1, 1)

        player4totalBetAmount = 0
        player4totalWin = 0
        player4totalLoss = 0
        player4totalProfit = 0
        player4TotalBankrollAmount = 0

        -- Reset banking information for the leaving player
        unitName4 = nil
        player4Name = nil

    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+5%.?") then
        player5Name = string.match(message, "{circle}%s+(%S+)%s+has%s+sat%s+down%s+in%s+Seat%s+5%.?")
        unitName5 = player5Name
        if unitName5 == unitName1 then
            unitName1 = nil
        elseif unitName5 == unitName2 then
            unitName2 = nil
        elseif unitName5 == unitName3 then
            unitName3 = nil
        elseif unitName5 == unitName4 then
            unitName4 = nil
        end
        playerFrame.player5Name:SetText(player5Name)
        playerFrame.takeSeat5Button:Disable()

        -- If the player has banking information stored, retrieve it
        if playerBankingInfo[player5Name] then
            local bankingInfo = playerBankingInfo[player5Name]
            player5BankingTotalWagered = bankingInfo.totalWagered
            historyFrame.player5totalWageredAmount:SetText(player5BankingTotalWagered .. " G")
            player5BankingTotalWon = bankingInfo.totalWon
            historyFrame.player5totalWonAmount:SetText(player5BankingTotalWon .. " G")
            player5BankingTotalLost = bankingInfo.totalLost
            historyFrame.player5totalLostAmount:SetText(player5BankingTotalLost .. " G")
            player5BankingTotalProfit = bankingInfo.totalProfit
            historyFrame.player5ProfitAmount:SetText(player5BankingTotalProfit .. " G")
            if player5BankingTotalProfit > 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.098, 0.878, 0.098)
            elseif player5BankingTotalProfit == 0 then
                historyFrame.player5ProfitAmount:SetTextColor(1, 1, 1)
            elseif player5BankingTotalProfit < 0 then
                historyFrame.player5ProfitAmount:SetTextColor(0.961, 0.306, 0.306)
            end
            player5BankingBankrollTable = bankingInfo.bankrollTable
            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5BankingBankrollTable .. " G")
            player5BankingBankrollCashDesk = bankingInfo.bankrollCashDesk
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5BankingBankrollCashDesk .. " G")
        else
            -- Initialize banking information if not found
            player5totalBetAmount = 0
            player5totalWin = 0
            player5totalLoss = 0
            player5totalProfit = 0
            player5TotalBankrollAmount = 0
        end
    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+left%s+Seat%s+5%.?") then
        playerFrame.player5Name:SetText("Seat Empty")
        if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() then
            playerFrame.takeSeat5Button:Disable()
        else
            playerFrame.takeSeat5Button:Enable()
        end

        player5Hotstreak = 0
        player5HotstreakImage1:Hide()
        player5HotstreakImage2:Hide()
        player5HotstreakImage3:Hide()
        player5HotstreakImage4:Hide()
        player5HotstreakImage5:Hide()
        player5HotstreakImage6:Hide()
        player5HotstreakImage7:Hide()
        player5HotstreakImage8:Hide()
        player5HotstreakImage9:Hide()
        player5HotstreakImage10:Hide()
        player5HotstreakImage11:Hide()
        player5HotstreakImage12:Hide()
        player5HotstreakImage13:Hide()
        player5HotstreakImage14:Hide()
        player5HotstreakImage15:Hide()

        local wageredString = historyFrame.player5totalWageredAmount:GetText()
        local wonString = historyFrame.player5totalWonAmount:GetText()
        local lostString = historyFrame.player5totalLostAmount:GetText()
        local profitString = historyFrame.player5ProfitAmount:GetText()
        local bankrollString = bankrollFrame.player5TotalBankrollTableDisplay:GetText()

        local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
        local wonAmount = tonumber(string.match(wonString, "(%d+)"))
        local lostAmount = tonumber(string.match(lostString, "(%d+)"))
        local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
        local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

        -- Store banking information for the leaving player
        if wageredAmount then
            playerBankingInfo[player5Name] = {
                totalWagered = wageredAmount,
                totalWon = wonAmount,
                totalLost = lostAmount,
                totalProfit = profitAmount,
                bankrollTable = bankrollAmount,
                bankrollCashDesk = bankrollAmount
            }
        end

        historyFrame.player5totalWageredAmount:SetText("0 G")
        historyFrame.player5totalWonAmount:SetText("0 G")
        historyFrame.player5totalLostAmount:SetText("0 G")
        historyFrame.player5ProfitAmount:SetText("0 G")
        historyFrame.player5ProfitAmount:SetTextColor(1, 1, 1)

        player5totalBetAmount = 0
        player5totalWin = 0
        player5totalLoss = 0
        player5totalProfit = 0
        player5TotalBankrollAmount = 0

        -- Reset banking information for the leaving player
        unitName5 = nil
        player5Name = nil

    elseif string.find(message, "{circle}%s+(%S+)%s+has%s+left%s+the%s+table%.?") then
        playerLeaving = string.match(message, "{circle}%s+(%S+)%s+has%s+left%s+the%s+table%.?")
        if playerLeaving == unitName1 then
            playerFrame.player1Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat1Button:Disable()
            else
                playerFrame.takeSeat1Button:Enable()
            end
        elseif playerLeaving == unitName2 then
            playerFrame.player2Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat2Button:Disable()
            else
                playerFrame.takeSeat2Button:Enable()
            end
        elseif playerLeaving == unitName3 then
            playerFrame.player3Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat3Button:Disable()
            else
                playerFrame.takeSeat3Button:Enable()
            end
        elseif playerLeaving == unitName4 then
            playerFrame.player4Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat4Button:Disable()
            else
                playerFrame.takeSeat4Button:Enable()
            end
        elseif playerLeaving == unitName5 then
            playerFrame.player5Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat5Button:Disable()
            else
                playerFrame.takeSeat5Button:Enable()
            end
        end
    --
    elseif string.find(message, "%[P1%] Placing") and string.find(message, "main") then
        player1PlaceCoinsMainBet()
        player1Active = true
        local player1MainBet = string.match(message, "(%d+)G")
        if player1MainBet then
            player1PlaceTextMainBet(message)
        else
        end
        if playerName == unitName1 then
            playerFrame.player1DealNowButton:Enable()
        end
    elseif string.find(message, "%[P1%] Placing") and string.find(message, "Perfect") then
        player1PlaceCoinsPPBet()
        local player1PPBet = string.match(message, "(%d+)G")
        if player1PPBet then
            player1PlaceTextPPBet(message)
        else
        end
        if playerName == unitName1 then
            playerFrame.player1DealNowButton:Enable()
        end
    elseif string.find(message, "%[P1%] Placing") and string.find(message, "21") then
        player1PlaceCoins213Bet()
        local player1213Bet = string.match(message, "(%d+)G")
        if player1213Bet then
            player1PlaceText213Bet(message)
        else
        end
        if playerName == unitName1 then
            playerFrame.player1DealNowButton:Enable()
        end
    elseif string.find(message, "%[P1%] Hit") then
        timerReset()
    elseif string.find(message, "%[P1%] %(H1%) Hit") then
        timerReset()
    elseif string.find(message, "%[P1%] %(H2%) Hit") then
        timerReset()
    elseif string.find(message, "%[P1%] Stand") then
        timerReset()

        -- Players: 1
        if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            if player2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            if player3BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            if player4BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        if player5BeforeStandValue == "Blackjack" then
                            turn = 111
                        else
                            turn = 91
                        end
                    else
                        turn = 71
                    end
                else
                    turn = 51
                end
            else
                turn = 31
            end
        end

        if player1AfterStandValue then
            playerFrame.player1CardTotalText:SetText(player1AfterStandValue)
        end
        
    elseif string.find(message, "%[P1%] %(H1%) Stand") then
        timerReset()

        -- Players: 1
        if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                turn = 23
            else
                turn = 16
            end
        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            if player1SplitHand2BeforeStandValue == "Blackjack" then 
                if player2BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end
        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            if player1SplitHand2BeforeStandValue == "Blackjack" then 
                if player3BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end
        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            if player1SplitHand2BeforeStandValue == "Blackjack" then 
                if player4BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end
        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            if player1SplitHand2BeforeStandValue == "Blackjack" then 
                if player5BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player2BeforeStandValue == "Blackjack" then 
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end
            -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player2BeforeStandValue == "Blackjack" then 
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end
            -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player2BeforeStandValue == "Blackjack" then 
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end
            -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player3BeforeStandValue == "Blackjack" then 
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player3BeforeStandValue == "Blackjack" then 
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player4BeforeStandValue == "Blackjack" then 
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player2BeforeStandValue == "Blackjack" then    
                    if player3BeforeStandValue == "Blackjack" then 
                        if player4BeforeStandValue == "Blackjack" then
                            turn = 89
                        else
                            turn = 69
                        end
                    else
                        turn = 49
                    end
                else
                    turn = 29
                end
            else
                turn = 22
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player2BeforeStandValue == "Blackjack" then    
                    if player3BeforeStandValue == "Blackjack" then 
                        if player5BeforeStandValue == "Blackjack" then
                            turn = 89
                        else
                            turn = 69
                        end
                    else
                        turn = 49
                    end
                else
                    turn = 29
                end
            else
                turn = 22
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player2BeforeStandValue == "Blackjack" then    
                    if player4BeforeStandValue == "Blackjack" then 
                        if player5BeforeStandValue == "Blackjack" then
                            turn = 89
                        else
                            turn = 69
                        end
                    else
                        turn = 49
                    end
                else
                    turn = 29
                end
            else
                turn = 22
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player3BeforeStandValue == "Blackjack" then    
                    if player4BeforeStandValue == "Blackjack" then 
                        if player5BeforeStandValue == "Blackjack" then
                            turn = 89
                        else
                            turn = 69
                        end
                    else
                        turn = 49
                    end
                else
                    turn = 29
                end
            else
                turn = 22
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player1SplitHand2BeforeStandValue == "Blackjack" then    
                if player2BeforeStandValue == "Blackjack" then    
                    if player3BeforeStandValue == "Blackjack" then    
                        if player4BeforeStandValue == "Blackjack" then 
                            if player5BeforeStandValue == "Blackjack" then
                                turn = 111
                            else
                                turn = 91
                            end
                        else
                            turn = 71
                        end
                    else
                        turn = 51
                    end
                else
                    turn = 31
                end
            else
                turn = 24
            end

        end

        if player1SplitHand1AfterStandValue then
            playerFrame.player1SplitHand1CardTotalText:SetText(player1SplitHand1AfterStandValue)
        end

    elseif string.find(message, "%[P1%] %(H2%) Stand") then
        timerReset()

        -- Players: 1
        if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            if player2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            if player3BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            if player4BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        if player5BeforeStandValue == "Blackjack" then
                            turn = 111
                        else
                            turn = 91
                        end
                    else
                        turn = 71
                    end
                else
                    turn = 51
                end
            else
                turn = 31
            end
        end

        if player1SplitHand2AfterStandValue then
            playerFrame.player1SplitHand2CardTotalText:SetText(player1SplitHand2AfterStandValue)
        end

    elseif string.find(message, "%[P1%] Double") then
        local betDoubleAmount1 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmount1 then
            player1PlaceCoinsDoubleBet()
            player1MainBetAmount:SetText(betDoubleAmount1 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 1
            if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                turn = 22

            -- Players: 1, 2
            elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 24
            -- Players: 1, 3
            elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 24
            -- Players: 1, 4
            elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 24
            -- Players: 1, 5
            elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 24

            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 26
            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 26
            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 26
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 26
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 26
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                turn = 26

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 28
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 28
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 28
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 28

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 30
            end

        end
    elseif string.find(message, "%[P1%] %(H1%) Double") then
        betDoubleAmountSplitH1 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH1 then
            player1SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 1
            if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                turn = 15

            -- Players: 1, 2
            elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 17
            -- Players: 1, 3
            elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 17
            -- Players: 1, 4
            elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 17
            -- Players: 1, 5
            elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 17

            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 19
            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 19
            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 19
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 19
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 19
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                turn = 19

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 21
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 21
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 21
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 21

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 23
            end

        end

        playerFrame.player1SplitHand1Coins:Hide()
        playerFrame.player1SplitHand1DoubleCoins:Show()

    elseif string.find(message, "%[P1%] %(H2%) Double") then
        betDoubleAmountSplitH2 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH2 then
            player1SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()
            
            -- Players: 1
            if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                turn = 21

            -- Players: 1, 2
            elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 23
            -- Players: 1, 3
            elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 23
            -- Players: 1, 4
            elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 23
            -- Players: 1, 5
            elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 23

            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 25
            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 25
            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 25
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 25
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 25
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                turn = 25

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 27
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 27
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 27
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 27

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 29
            end

        end

        playerFrame.player1SplitHand2Coins:Hide()
        playerFrame.player1SplitHand2DoubleCoins:Show()

    elseif string.find(message, "%[P1%] Split") then
        player1HandleSplit(message)
    --
    elseif string.find(message, "%[P2%] Placing") and string.find(message, "main") then
        player2PlaceCoinsMainBet() 
        player2Active = true
        local player2MainBet = string.match(message, "(%d+)G")
        if player2MainBet then
            player2PlaceTextMainBet(message)
        else
        end
        if playerName == unitName2 then
            playerFrame.player2DealNowButton:Enable()
        end
    elseif string.find(message, "%[P2%] Placing") and string.find(message, "Perfect") then
        player2PlaceCoinsPPBet()
        local player2PPBet = string.match(message, "(%d+)G")
        if player2PPBet then
            player2PlaceTextPPBet(message)
        else
        end
        if playerName == unitName2 then
            playerFrame.player2DealNowButton:Enable()
        end
    elseif string.find(message, "%[P2%] Placing") and string.find(message, "21") then
        player2PlaceCoins213Bet()
        local player2213Bet = string.match(message, "(%d+)G")
        if player2213Bet then
            player2PlaceText213Bet(message)
        else
        end
        if playerName == unitName2 then
            playerFrame.player2DealNowButton:Enable()
        end
    elseif string.find(message, "%[P2%] Hit") then
        timerReset()
    elseif string.find(message, "%[P2%] %(H1%) Hit") then
        timerReset()
    elseif string.find(message, "%[P2%] %(H2%) Hit") then
        timerReset()
    elseif string.find(message, "%[P2%] Stand") then
        timerReset()

        -- Players: 2
        if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 45
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            if player3BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            if player4BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
            
        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 111
                    else
                        turn = 91
                    end
                else
                    turn = 71
                end
            else
                turn = 51
            end

        end

        if player2AfterStandValue then
            playerFrame.player2CardTotalText:SetText(player2AfterStandValue)
        end

    elseif string.find(message, "%[P2%] %(H1%) Stand") then
        timerReset()
            
        -- Players: 2
        if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                turn = 23
            else
                turn = 16
            end

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 38
            end
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end
                
        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end
            -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end
            -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 42
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 42
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 42
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        if player5BeforeStandValue == "Blackjack" then
                            turn = 89
                        else
                            turn = 69
                        end
                    else
                        turn = 49
                    end
                else
                    turn = 29
                end
            else
                turn = 22
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player2SplitHand2BeforeStandValue == "Blackjack" then
                if player3BeforeStandValue == "Blackjack" then
                    if player4BeforeStandValue == "Blackjack" then
                        if player5BeforeStandValue == "Blackjack" then
                            turn = 111
                        else
                            turn = 91
                        end
                    else
                        turn = 71
                    end
                else
                    turn = 51
                end
            else
                turn = 44
            end

        end

        if player2SplitHand1AfterStandValue then
            playerFrame.player2SplitHand1CardTotalText:SetText(player2SplitHand1AfterStandValue)
        end

    elseif string.find(message, "%[P2%] %(H2%) Stand") then
        timerReset()

        -- Players: 2
        if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 2
        elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
            turn = 45
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            if player3BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            if player4BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
            
        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 29
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player3BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 111
                    else
                        turn = 91
                    end
                else
                    turn = 71
                end
            else
                turn = 51
            end

        end

        if player2SplitHand2AfterStandValue then
            playerFrame.player2SplitHand2CardTotalText:SetText(player2SplitHand2AfterStandValue)
        end

    elseif string.find(message, "%[P2%] Double") then
        local betDoubleAmount2 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmount2 then
            player2PlaceCoinsDoubleBet()
            player2MainBetAmount:SetText(betDoubleAmount2 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 2
            if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 22

            -- Players: 1, 2
            elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 44
            -- Players: 2, 3
            elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                turn = 24
            -- Players: 2, 4
            elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                turn = 24
            -- Players: 2, 5
            elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                turn = 24
                
            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 46
            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 46
            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 46
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 26
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 26
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 26

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 48
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 48
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 48
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 28

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 50

            end
        end
    elseif string.find(message, "%[P2%] %(H1%) Double") then
        betDoubleAmountSplitH1 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH1 then
            player2SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 2
            if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 15

            -- Players: 1, 2
            elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 37
            -- Players: 2, 3
            elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                turn = 17
            -- Players: 2, 4
            elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                turn = 17
            -- Players: 2, 5
            elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                turn = 17
                
            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 39
            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 39
            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 39
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 19
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 19
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 19

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 41
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 41
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 41
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 21

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 43

            end

        end

        playerFrame.player2SplitHand1Coins:Hide()
        playerFrame.player2SplitHand1DoubleCoins:Show()

    elseif string.find(message, "%[P2%] %(H2%) Double") then
        betDoubleAmountSplitH2 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH2 then
            player2SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()
            
            -- Players: 2
            if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 21

            -- Players: 1, 2
            elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                turn = 43
            -- Players: 2, 3
            elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                turn = 23
            -- Players: 2, 4
            elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                turn = 23
            -- Players: 2, 5
            elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                turn = 23
                
            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 45
            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 45
            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 45
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 25
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 25
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 25

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 47
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 47
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 47
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 27

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 49

            end

        end

        playerFrame.player2SplitHand2Coins:Hide()
        playerFrame.player2SplitHand2DoubleCoins:Show()

    elseif string.find(message, "%[P2%] Split") then
        player2HandleSplit(message)
    --
    elseif string.find(message, "%[P3%] Placing") and string.find(message, "main") then
        player3PlaceCoinsMainBet() 
        player3Active = true
        local betAmountMain3 = string.match(message, "(%d+)G")
        if betAmountMain3 then
            player3PlaceTextMainBet(message)
        else
        end
        if playerName == unitName3 then
            playerFrame.player3DealNowButton:Enable()
        end
    elseif string.find(message, "%[P3%] Placing") and string.find(message, "Perfect") then
        player3PlaceCoinsPPBet()
        local betAmountPP3 = string.match(message, "(%d+)G")
        if betAmountPP3 then
            player3PlaceTextPPBet(message)
        else
        end
        if playerName == unitName3 then
            playerFrame.player3DealNowButton:Enable()
        end
    elseif string.find(message, "%[P3%] Placing") and string.find(message, "21") then
        player3PlaceCoins213Bet()
        local betAmount2133 = string.match(message, "(%d+)G")
        if betAmount2133 then
            player3PlaceText213Bet(message)
        else
        end
        if playerName == unitName3 then
            playerFrame.player3DealNowButton:Enable()
        end
    elseif string.find(message, "%[P3%] Hit") then
        timerReset()
    elseif string.find(message, "%[P3%] %(H1%) Hit") then
        timerReset()
    elseif string.find(message, "%[P3%] %(H2%) Hit") then
        timerReset()
    elseif string.find(message, "%[P3%] Stand") then
        timerReset()

        -- Players: 3
        if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 45
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 45
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            if player4BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 67
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 111
                else
                    turn = 91
                end
            else
                turn = 71
            end

        end

        if player3AfterStandValue then
            playerFrame.player3CardTotalText:SetText(player3AfterStandValue)
        end

    elseif string.find(message, "%[P3%] %(H1%) Stand") then
        timerReset()

        -- Players: 3
        if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                turn = 23
            else
                turn = 16
            end

        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 38
            end
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 38
            end
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 25
                end
            else
                turn = 18
            end

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                else
                    turn = 27
                end
            else
                turn = 20
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 62
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 62
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 42
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                else
                    turn = 49
                end
            else
                turn = 42
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player3SplitHand2BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 111
                    else
                        turn = 91
                    end
                else
                    turn = 71
                end
            else
                turn = 64
            end
    
        end

        if player3SplitHand1AfterStandValue then
            playerFrame.player3SplitHand1CardTotalText:SetText(player3SplitHand1AfterStandValue)
        end

    elseif string.find(message, "%[P3%] %(H2%) Stand") then
        timerReset()

        -- Players: 3
        if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 23

        -- Players: 1, 3
        elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
            turn = 45
        -- Players: 2, 3
        elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
            turn = 45
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            if player4BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end

        -- Players: 1, 2, 3
        elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
            turn = 67
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player4BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 27
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 49
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player4BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 111
                else
                    turn = 91
                end
            else
                turn = 71
            end

        end

        if player3SplitHand2AfterStandValue then
            playerFrame.player3SplitHand2CardTotalText:SetText(player3SplitHand2AfterStandValue)
        end

    elseif string.find(message, "%[P3%] Double") then
        local betDoubleAmount3 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmount3 then
            player3PlaceCoinsDoubleBet()
            player3MainBetAmount:SetText(betDoubleAmount3 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 3
            if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 22

            -- Players: 1, 3
            elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 44
            -- Players: 2, 3
            elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                turn = 44
            -- Players: 3, 4
            elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                turn = 24
            -- Players: 3, 5
            elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                turn = 24

            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 66
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 46
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 46
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 46
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 46
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 26

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 68
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 68
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 48
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 48

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 70

            end
        end

    elseif string.find(message, "%[P3%] %(H1%) Double") then
        betDoubleAmountSplitH1 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH1 then
            player3SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 3
            if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 15

            -- Players: 1, 3
            elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 37
            -- Players: 2, 3
            elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                turn = 37
            -- Players: 3, 4
            elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                turn = 17
            -- Players: 3, 5
            elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                turn = 17

            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 59
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 39
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 39
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 39
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 39
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 19

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 61
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 61
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 41
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 41

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 63

            end
        end

        playerFrame.player3SplitHand1Coins:Hide()
        playerFrame.player3SplitHand1DoubleCoins:Show()

    elseif string.find(message, "%[P3%] %(H2%) Double") then
        betDoubleAmountSplitH2 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH2 then
            player3SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 3
            if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 21

            -- Players: 1, 3
            elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                turn = 43
            -- Players: 2, 3
            elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                turn = 43
            -- Players: 3, 4
            elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                turn = 23
            -- Players: 3, 5
            elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                turn = 23

            -- Players: 1, 2, 3
            elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                turn = 65
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 45
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 45
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 45
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 45
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 25

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 67
            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 67
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 47
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 47

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 69

            end
        end

        playerFrame.player3SplitHand2Coins:Hide()
        playerFrame.player3SplitHand2DoubleCoins:Show()


    elseif string.find(message, "%[P3%] Split") then
        player3HandleSplit(message) 
    --
    elseif string.find(message, "%[P4%] Placing") and string.find(message, "main") then
        player4PlaceCoinsMainBet() 
        player4Active = true
        local betAmountMain4 = string.match(message, "(%d+)G")
        if betAmountMain4 then
            player4PlaceTextMainBet(message)
        else
        end
        if playerName == unitName4 then
            playerFrame.player4DealNowButton:Enable()
        end
    elseif string.find(message, "%[P4%] Placing") and string.find(message, "Perfect") then
        player4PlaceCoinsPPBet()
        local betAmountPP4 = string.match(message, "(%d+)G")
        if betAmountPP4 then
            player4PlaceTextPPBet(message)
        else
        end
        if playerName == unitName4 then
            playerFrame.player4DealNowButton:Enable()
        end
    elseif string.find(message, "%[P4%] Placing") and string.find(message, "21") then
        player4PlaceCoins213Bet()
        local betAmount2134 = string.match(message, "(%d+)G")
        if betAmount2134 then
            player4PlaceText213Bet(message)
        else
        end
        if playerName == unitName4 then
            playerFrame.player4DealNowButton:Enable()
        end
    elseif string.find(message, "%[P4%] Hit") then
        timerReset()
    elseif string.find(message, "%[P4%] %(H1%) Hit") then
        timerReset()
    elseif string.find(message, "%[P4%] %(H2%) Hit") then
        timerReset()
    elseif string.find(message, "%[P4%] Stand") then
        timerReset()

        -- Players: 4
        if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 23

        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 45
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 45
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 45
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end

        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 67
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 67
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 67
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 89
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 111
            else
                turn = 91
            end
        end
        
        if player4AfterStandValue then
            playerFrame.player4CardTotalText:SetText(player4AfterStandValue)
        end

    elseif string.find(message, "%[P4%] %(H1%) Stand") then
        timerReset()

        -- Players: 4
        if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 23
            else
                turn = 16
            end

        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 38
            end
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 38
            end
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 38
            end
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 45
                else
                    turn = 38
                end
            else
                turn = 18
            end

        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 67
                else
                    turn = 47
                end
            else
                turn = 40
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 82
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 62
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 62
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 89
                else
                    turn = 69
                end
            else
                turn = 62
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player4SplitHand2BeforeStandValue == "Blackjack" then
                if player5BeforeStandValue == "Blackjack" then
                    turn = 111
                else
                    turn = 91
                end
            else
                turn = 84
            end    
            
        end

        if player4SplitHand1AfterStandValue then
            playerFrame.player4SplitHand1CardTotalText:SetText(player4SplitHand1AfterStandValue)
        end

    elseif string.find(message, "%[P4%] %(H2%) Stand") then
        timerReset()

        -- Players: 4
        if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 23

        -- Players: 1, 4
        elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            turn = 45
        -- Players: 2, 4
        elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
            turn = 45
        -- Players: 3, 4
        elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            turn = 45
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            if player5BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 25
            end

        -- Players: 1, 2, 4
        elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
            turn = 67
        -- Players: 1, 3, 4
        elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
            turn = 67
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 2, 3, 4
        elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 67
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 47
            end

        -- Players: 1, 2, 3, 4
        elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            turn = 89
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 69
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player5BeforeStandValue == "Blackjack" then
                turn = 111
            else
                turn = 91
            end
        end
        
        if player4SplitHand2AfterStandValue then
            playerFrame.player4SplitHand2CardTotalText:SetText(player4SplitHand2AfterStandValue)
        end

    elseif string.find(message, "%[P4%] Double") then
        local betDoubleAmount4 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmount4 then
            player4PlaceCoinsDoubleBet()
            player4MainBetAmount:SetText(betDoubleAmount4 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 4
            if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 22

            -- Players: 1, 4
            elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 44
            -- Players: 2, 4
            elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                turn = 44
            -- Players: 3, 4
            elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                turn = 44
            -- Players: 4, 5
            elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                turn = 24

            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 66
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 66
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                turn = 46
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 66
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 46
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 46

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 88
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 68
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 68
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 68

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 90
            end

        end

    elseif string.find(message, "%[P4%] %(H1%) Double") then
        betDoubleAmountSplitH1 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH1 then
            player4SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 4
            if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 15

            -- Players: 1, 4
            elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 37
            -- Players: 2, 4
            elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                turn = 37
            -- Players: 3, 4
            elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                turn = 37
            -- Players: 4, 5
            elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                turn = 17

            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 59
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 59
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                turn = 39
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 59
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 39
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 39

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 81
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 61
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 61
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 61

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 83
            end
            
        end

        playerFrame.player4SplitHand1Coins:Hide()
        playerFrame.player4SplitHand1DoubleCoins:Show()

    elseif string.find(message, "%[P4%] %(H2%) Double") then
        betDoubleAmountSplitH2 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH2 then
            player4SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 4
            if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 21

            -- Players: 1, 4
            elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                turn = 43
            -- Players: 2, 4
            elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                turn = 43
            -- Players: 3, 4
            elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                turn = 43
            -- Players: 4, 5
            elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                turn = 23

            -- Players: 1, 2, 4
            elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                turn = 65
            -- Players: 1, 3, 4
            elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                turn = 65
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                turn = 45
            -- Players: 2, 3, 4
            elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 65
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 45
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 45

            -- Players: 1, 2, 3, 4
            elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                turn = 87
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 67
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 67
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 67

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 89
            end

        end

        playerFrame.player4SplitHand2Coins:Hide()
        playerFrame.player4SplitHand2DoubleCoins:Show()

    elseif string.find(message, "%[P4%] Split") then 
        player4HandleSplit(message)
    --
    elseif string.find(message, "%[P5%] Placing") and string.find(message, "main") then
        player5PlaceCoinsMainBet() 
        player5Active = true
        local betAmountMain5 = string.match(message, "(%d+)G")
        if betAmountMain5 then
            player5PlaceTextMainBet(message)
        else
        end
        if playerName == unitName5 then
            playerFrame.player5DealNowButton:Enable()
        end
    elseif string.find(message, "%[P5%] Placing") and string.find(message, "Perfect") then
        player5PlaceCoinsPPBet()
        local betAmountPP5 = string.match(message, "(%d+)G")
        if betAmountPP5 then
            player5PlaceTextPPBet(message)
        else
        end
        if playerName == unitName5 then
            playerFrame.player5DealNowButton:Enable()
        end
    elseif string.find(message, "%[P5%] Placing") and string.find(message, "21") then
        player5PlaceCoins213Bet()
        local betAmount2135 = string.match(message, "(%d+)G")
        if betAmount2135 then
            player5PlaceText213Bet(message)
        else
        end
        if playerName == unitName5 then
            playerFrame.player5DealNowButton:Enable()
        end
    elseif string.find(message, "%[P5%] Hit") then
        timerReset()
    elseif string.find(message, "%[P5%] %(H1%) Hit") then
        timerReset()
    elseif string.find(message, "%[P5%] %(H2%) Hit") then
        timerReset()
    elseif string.find(message, "%[P5%] Stand") then
        timerReset()

        -- Players: 5
        if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 23

        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 45
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 45
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 45
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 45

        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 67
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 67
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
            turn = 67
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 67
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 67
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 67

        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 89
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 89
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 89
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 89

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 111
        end

        if player5AfterStandValue then
            playerFrame.player5CardTotalText:SetText(player5AfterStandValue)
        end

    elseif string.find(message, "%[P5%] %(H1%) Stand") then
        timerReset()

        -- Players: 5
        if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 23
            else
                turn = 16
            end

        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 18
            end
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 18
            end
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 18
            end
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 45
            else
                turn = 18
            end

        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 67
            else
                turn = 60
            end

        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 82
            end
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 82
            end
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 82
            end
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 89
            else
                turn = 82
            end

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            if player5SplitHand2BeforeStandValue == "Blackjack" then
                turn = 111
            else
                turn = 104
            end

        end
        
        if player5SplitHand1AfterStandValue then
            playerFrame.player5SplitHand1CardTotalText:SetText(player5SplitHand1AfterStandValue)
        end

    elseif string.find(message, "%[P5%] %(H2%) Stand") then
        timerReset()

        -- Players: 5
        if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 23

        -- Players: 1, 5
        elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
            turn = 45
        -- Players: 2, 5
        elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
            turn = 45
        -- Players: 3, 5
        elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
            turn = 45
        -- Players: 4, 5
        elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
            turn = 45

        -- Players: 1, 2, 5
        elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
            turn = 67
        -- Players: 1, 3, 5
        elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
            turn = 67
        -- Players: 1, 4, 5
        elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
            turn = 67
        -- Players: 2, 3, 5
        elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 67
        -- Players: 2, 4, 5
        elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 67
        -- Players: 3, 4, 5
        elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 67

        -- Players: 1, 2, 3, 5
        elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
            turn = 89
        -- Players: 1, 2, 4, 5
        elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
            turn = 89
        -- Players: 1, 3, 4, 5
        elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
            turn = 89
        -- Players: 2, 3, 4, 5
        elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 89

        -- Players: 1, 2, 3, 4, 5
        elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
            turn = 111
        end

        if player5SplitHand2AfterStandValue then
            playerFrame.player5SplitHand2CardTotalText:SetText(player5SplitHand2AfterStandValue)
        end

    elseif string.find(message, "%[P5%] Double") then
        local betDoubleAmount5 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmount5 then
            player5PlaceCoinsDoubleBet()
            player5MainBetAmount:SetText(betDoubleAmount5 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 5
            if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 22

            -- Players: 1, 5
            elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 44
            -- Players: 2, 5
            elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                turn = 44
            -- Players: 3, 5
            elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                turn = 44
            -- Players: 4, 5
            elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                turn = 44

            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 66
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 66
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                turn = 66
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 66
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 66
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 66

            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 88
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 88
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 88
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 88

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 110
            end
        end

    elseif string.find(message, "%[P5%] %(H1%) Double") then
        betDoubleAmountSplitH1 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH1 then
            player5SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 5
            if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 15

            -- Players: 1, 5
            elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 37
            -- Players: 2, 5
            elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                turn = 37
            -- Players: 3, 5
            elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                turn = 37
            -- Players: 4, 5
            elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                turn = 37

            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 59
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 59
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                turn = 59
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 59
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 59
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 59

            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 81
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 81
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 81
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 81

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 103
            end
        end

        playerFrame.player5SplitHand1Coins:Hide()
        playerFrame.player5SplitHand1DoubleCoins:Show()

    elseif string.find(message, "%[P5%] %(H2%) Double") then
        betDoubleAmountSplitH2 = string.match(message, "Double my bet to (%d+)G")
        if betDoubleAmountSplitH2 then
            player5SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            PlaySoundFile(soundFilePaths[33])
            timerReset()

            -- Players: 5
            if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 21

            -- Players: 1, 5
            elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                turn = 43
            -- Players: 2, 5
            elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                turn = 43
            -- Players: 3, 5
            elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                turn = 43
            -- Players: 4, 5
            elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                turn = 43

            -- Players: 1, 2, 5
            elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                turn = 65
            -- Players: 1, 3, 5
            elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                turn = 65
            -- Players: 1, 4, 5
            elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                turn = 65
            -- Players: 2, 3, 5
            elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 65
            -- Players: 2, 4, 5
            elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 65
            -- Players: 3, 4, 5
            elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 65

            -- Players: 1, 2, 3, 5
            elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                turn = 87
            -- Players: 1, 2, 4, 5
            elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                turn = 87
            -- Players: 1, 3, 4, 5
            elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                turn = 87
            -- Players: 2, 3, 4, 5
            elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 87

            -- Players: 1, 2, 3, 4, 5
            elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                turn = 109
            end
        end

        playerFrame.player5SplitHand2Coins:Hide()
        playerFrame.player5SplitHand2DoubleCoins:Show()

    elseif string.find(message, "%[P5%] Split") then
        player5HandleSplit(message)
    else     
    end

    AddMessageToScrollFrame(message, sender)
end)

-- Chat event to listen for raid leader chat messages
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("CHAT_MSG_RAID_LEADER")
eventFrame:SetScript("OnEvent", function(self, event, message, sender)

    if sender == "Hyrav-LivingFlame" or "Blackjack-ChaosBolt" or UnitIsGroupLeader(sender,"raid") then
        
        HandleChatMessage(message)
        
        if message == "I have opened the table." then
            EnableJoinButton()
        elseif string.find(message, "Version") then
            SendChatMessage("{star} I am running version " .. version .. " {star}", "RAID")
        elseif string.find(message, "Table ID") then
            local pattern = "Table ID: (%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(%d-)%.(.-)$"
            local variables = {}
        
            for match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13 in message:gmatch(pattern) do
                table.insert(variables, match1)
                table.insert(variables, match2)
                table.insert(variables, match3)
                table.insert(variables, match4)
                table.insert(variables, match5)
                table.insert(variables, match6)
                table.insert(variables, match7)
                table.insert(variables, match8)
                table.insert(variables, match9)
                table.insert(variables, match10)
                table.insert(variables, match11)
                table.insert(variables, match12)
                table.insert(variables, match13)
            end
        
            local var1 = variables[1] or "N/A"
            local var2 = variables[2] or "N/A"
            local var3 = variables[3] or "N/A"
            local var4 = variables[4] or "N/A"
            local var5 = variables[5] or "N/A"
            local var6 = variables[6] or "N/A"
            local var7 = variables[7] or "N/A"
            local var8 = variables[8] or "N/A"
            local var9 = variables[9] or "N/A"
            local var10 = variables[10] or "N/A"
            local var11 = variables[11] or "N/A"
            local var12 = variables[12] or "N/A"
            local var13 = variables[13] or "N/A"
            
            if var1 == "1" then
                numberOfDecksInShoeText:SetText("1     (52 cards total)")
            elseif var1 == "2" then
                numberOfDecksInShoeText:SetText("2     (104 cards total)")
            elseif var1 == "3" then
                numberOfDecksInShoeText:SetText("3     (156 cards total)")
            elseif var1 == "4" then
                numberOfDecksInShoeText:SetText("4     (208 cards total)")
            elseif var1 == "5" then
                numberOfDecksInShoeText:SetText("5     (260 cards total)")
            elseif var1 == "6" then
                numberOfDecksInShoeText:SetText("6     (312 cards total)")
            elseif var1 == "7" then
                numberOfDecksInShoeText:SetText("7     (364 cards total)")
            elseif var1 == "8" then
                numberOfDecksInShoeText:SetText("8     (416 cards total)")
            end

            minBetMain = tonumber(var2) or 0
            maxBetMain = tonumber(var4) or 0
            minBetPP = tonumber(var3) or 0
            minBet213 = tonumber(var3) or 0
            maxBetPP = tonumber(var5) or 0
            maxBet213 = tonumber(var5) or 0

            tableLimitsMainText:SetText(minBetMain .. "G  -  " .. maxBetMain .."G")
            tableLimitsSideText:SetText(minBetPP .. "G  -  " .. maxBetPP .."G")

            mixedPairPayoutValue = tonumber(var6) or 0
            colouredPairPayoutValue = tonumber(var7) or 0
            perfectPairPayoutValue = tonumber(var8) or 0
            flushPayoutValue = tonumber(var9) or 0
            straightPayoutValue = tonumber(var10) or 0
            threeOfAKindPayoutValue = tonumber(var11) or 0
            straightFlushPayoutValue = tonumber(var12) or 0
            suitedThreeOfAKindPayoutValue = tonumber(var13) or 0

            payoutsFrame.mixedPairPayout:SetText(mixedPairPayoutValue .. ":1")
            payoutsFrame.colouredPairPayout:SetText(colouredPairPayoutValue .. ":1")
            payoutsFrame.perfectPairPayout:SetText(perfectPairPayoutValue .. ":1")
            payoutsFrame.flushPayout:SetText(flushPayoutValue .. ":1")
            payoutsFrame.straightPayout:SetText(straightPayoutValue .. ":1")
            payoutsFrame.threeOfAKindPayout:SetText(threeOfAKindPayoutValue .. ":1")
            payoutsFrame.straightFlushPayout:SetText(straightFlushPayoutValue .. ":1")
            payoutsFrame.suitedThreeOfAKindPayout:SetText(suitedThreeOfAKindPayoutValue .. ":1")

        elseif string.find(message, "has locked the table") then
            tableLocked = true
            player1ConfirmMainBetButton:Disable()
            player1ConfirmPPBetButton:Disable()
            player1Confirm213BetButton:Disable()
            player1PreloadBetButton:Disable()
            player2ConfirmMainBetButton:Disable()
            player2ConfirmPPBetButton:Disable()
            player2Confirm213BetButton:Disable()
            player2PreloadBetButton:Disable()
            player3ConfirmMainBetButton:Disable()
            player3ConfirmPPBetButton:Disable()
            player3Confirm213BetButton:Disable()
            player3PreloadBetButton:Disable()
            player4ConfirmMainBetButton:Disable()
            player4ConfirmPPBetButton:Disable()
            player4Confirm213BetButton:Disable()
            player4PreloadBetButton:Disable()
            player5ConfirmMainBetButton:Disable()
            player5ConfirmPPBetButton:Disable()
            player5Confirm213BetButton:Disable()
            player5PreloadBetButton:Disable()
        elseif string.find(message, "has unlocked the table") then
            tableLocked = false
            player1ConfirmMainBetButton:Enable()
            player1ConfirmPPBetButton:Enable()
            player1Confirm213BetButton:Enable()
            player1PreloadBetButton:Enable()
            player2ConfirmMainBetButton:Enable()
            player2ConfirmPPBetButton:Enable()
            player2Confirm213BetButton:Enable()
            player2PreloadBetButton:Enable()
            player3ConfirmMainBetButton:Enable()
            player3ConfirmPPBetButton:Enable()
            player3Confirm213BetButton:Enable()
            player3PreloadBetButton:Enable()
            player4ConfirmMainBetButton:Enable()
            player4ConfirmPPBetButton:Enable()
            player4Confirm213BetButton:Enable()
            player4PreloadBetButton:Enable()
            player5ConfirmMainBetButton:Enable()
            player5ConfirmPPBetButton:Enable()
            player5Confirm213BetButton:Enable()
            player5PreloadBetButton:Enable()
        elseif string.find(message, "forced a reload") then
            forceReload()
        elseif string.find(message, "{cross}%s*Seat%s*1:%s*(%S+)%s*") then
            local seat1Player = string.match(message, "{cross}%s*Seat%s*1:%s*(%S+)%s*")
            if seat1Player then
                playerFrame.player1Name:SetText(seat1Player)
                unitName1 = seat1Player
                playerFrame.takeSeat1Button:Disable()
            end
        elseif string.find(message, "{triangle}%s*Seat%s*1:%s*Available%s*") then
            playerFrame.player1Name:SetText("Seat Empty")
            unitName1 = nil
            playerFrame.takeSeat1Button:Enable()
        elseif string.find(message, "{cross}%s*Seat%s*2:%s*(%S+)%s*") then
            local seat2Player = string.match(message, "{cross}%s*Seat%s*2:%s*(%S+)%s*")
            if seat2Player then
                playerFrame.player2Name:SetText(seat2Player)
                unitName2 = seat2Player
                playerFrame.takeSeat2Button:Disable()
            end
        elseif string.find(message, "{triangle}%s*Seat%s*2:%s*Available%s*") then
            playerFrame.player2Name:SetText("Seat Empty")
            unitName2 = nil
            playerFrame.takeSeat2Button:Enable()
        elseif string.find(message, "{cross}%s*Seat%s*3:%s*(%S+)%s*") then
            local seat3Player = string.match(message, "{cross}%s*Seat%s*3:%s*(%S+)%s*")
            if seat3Player then
                playerFrame.player3Name:SetText(seat3Player)
                unitName3 = seat3Player
                playerFrame.takeSeat3Button:Disable()
            end
        elseif string.find(message, "{triangle}%s*Seat%s*3:%s*Available%s*") then
            playerFrame.player3Name:SetText("Seat Empty")
            unitName3 = nil
            playerFrame.takeSeat3Button:Enable()
        elseif string.find(message, "{cross}%s*Seat%s*4:%s*(%S+)%s*") then
            local seat4Player = string.match(message, "{cross}%s*Seat%s*4:%s*(%S+)%s*")
            if seat4Player then
                playerFrame.player4Name:SetText(seat4Player)
                unitName4 = seat4Player
                playerFrame.takeSeat4Button:Disable()
            end
        elseif string.find(message, "{triangle}%s*Seat%s*4:%s*Available%s*") then
            playerFrame.player4Name:SetText("Seat Empty")
            unitName4 = nil
            playerFrame.takeSeat4Button:Enable()
        elseif string.find(message, "{cross}%s*Seat%s*5:%s*(%S+)%s*") then
            local seat5Player = string.match(message, "{cross}%s*Seat%s*5:%s*(%S+)%s*")
            if seat5Player then
                playerFrame.player5Name:SetText(seat5Player)
                unitName5 = seat5Player
                playerFrame.takeSeat5Button:Disable()
            end
        elseif string.find(message, "{triangle}%s*Seat%s*5:%s*Available%s*") then
            playerFrame.player5Name:SetText("Seat Empty")
            unitName5 = nil
            playerFrame.takeSeat5Button:Enable()
        elseif string.find(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+1%.?") then
            playerGettingKicked = string.match(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+1%.?")
            playerFrame.player1Name:SetText("Seat Empty")
            if playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat1Button:Disable()
            else
                playerFrame.takeSeat1Button:Enable()
            end
    
            player1Hotstreak = 0
            player1HotstreakImage1:Hide()
            player1HotstreakImage2:Hide()
            player1HotstreakImage3:Hide()
            player1HotstreakImage4:Hide()
            player1HotstreakImage5:Hide()
            player1HotstreakImage6:Hide()
            player1HotstreakImage7:Hide()
            player1HotstreakImage8:Hide()
            player1HotstreakImage9:Hide()
            player1HotstreakImage10:Hide()
            player1HotstreakImage11:Hide()
            player1HotstreakImage12:Hide()
            player1HotstreakImage13:Hide()
            player1HotstreakImage14:Hide()
            player1HotstreakImage15:Hide()
    
            player1totalBetAmount = 0
            player1totalWin = 0
            player1totalLoss = 0
            player1totalProfit = 0
            player1TotalBankrollAmount = 0
    
            -- Reset banking information for the leaving player
            unitName1 = nil
            player1Name = nil

            if playerName == playerGettingKicked then
                local wageredString = historyFrame.player1totalWageredAmount:GetText()
                local wonString = historyFrame.player1totalWonAmount:GetText()
                local lostString = historyFrame.player1totalLostAmount:GetText()
                local profitString = historyFrame.player1ProfitAmount:GetText()
                local bankrollString = bankrollFrame.player1TotalBankrollTableDisplay:GetText()

                local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
                local wonAmount = tonumber(string.match(wonString, "(%d+)"))
                local lostAmount = tonumber(string.match(lostString, "(%d+)"))
                local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
                local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

                -- Store banking information for the leaving player
                if wageredAmount then
                    playerBankingInfo[playerName] = {
                        totalWagered = wageredAmount,
                        totalWon = wonAmount,
                        totalLost = lostAmount,
                        totalProfit = profitAmount,
                        bankrollTable = bankrollAmount,
                        bankrollCashDesk = bankrollAmount
                    }
                else
                    print("wageredAmount == nil")
                end

                historyFrame.player1totalWageredAmount:SetText("0 G")
                historyFrame.player1totalWonAmount:SetText("0 G")
                historyFrame.player1totalLostAmount:SetText("0 G")
                historyFrame.player1ProfitAmount:SetText("0 G")
                historyFrame.player1ProfitAmount:SetTextColor(1, 1, 1)

                player1dealtCardsFrame:Hide()
                player1dealtCardsFrameSplitH1:Hide()
                player1dealtCardsFrameSplitH2:Hide()
                player1PreloadBetButton:Hide()
                player1PreloadEditBoxMainBet:Hide()
                player1PreloadEditBoxPPBet:Hide()
                player1PreloadEditBox213Bet:Hide()
                playerFrame.leaveSeat1Button:Hide()
                playerFrame.player1HitButton:Hide()
                playerFrame.player1StandButton:Hide()
                playerFrame.player1DoubleButton:Hide()
                playerFrame.player1SplitButton:Hide()
                playerFrame.player1InsuranceYesButton:Hide()
                playerFrame.player1InsuranceNoButton:Hide()
                playerFrame.player1DealNowButton:Hide()
                player1ConfirmMainBetButton:Hide()
                player1ConfirmPPBetButton:Hide()
                player1Confirm213BetButton:Hide()
                player1MainBetEditBox:Hide()
                player1PPBetEditBox:Hide()
                player1213BetEditBox:Hide()
                playerFrame.player1MainBetTitle:Hide()
                playerFrame.player1PPBetTitle:Hide()
                playerFrame.player1213BetTitle:Hide()
                playerFrame.player1InsuranceTitle:Hide()
                playerFrame.player1InsuranceSubtitle:Hide()
                menuFrame.cardsButton:Disable()
                playerFrame.historyButton:Disable()
                menuFrame.preloadButton:Disable()
                playerFrame.cashDeskButton:Disable()
                playerFrame.takeSeat1Button:Show()
                if playerFrame.player2Name:GetText() == "Seat Empty" then    
                    playerFrame.takeSeat2Button:Enable()
                end
                if playerFrame.player3Name:GetText() == "Seat Empty" then  
                    playerFrame.takeSeat3Button:Enable()
                end
                if playerFrame.player4Name:GetText() == "Seat Empty" then 
                    playerFrame.takeSeat4Button:Enable()
                end
                if playerFrame.player5Name:GetText() == "Seat Empty" then
                    playerFrame.takeSeat5Button:Enable()
                end
                cashDeskFrame.player1TotalBankroll:Hide()
                historyFrame:Hide()
                preloadFrame:Hide()
                historyFrame.player1totalWageredAmount:Hide()
                historyFrame.player1totalWonAmount:Hide()
                historyFrame.player1totalLostAmount:Hide()
                historyFrame.player1ProfitAmount:Hide()
                bankrollFrame.player1TotalBankrollTableDisplay:Hide()
                bankrollFrame.BaseTextDisplay:Show()
                seatFrame:Hide()
                seatFrame.seat1:Hide()
            end
        elseif string.find(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+2%.?") then
            playerGettingKicked = string.match(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+2%.?")
            playerFrame.player2Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat2Button:Disable()
            else
                playerFrame.takeSeat2Button:Enable()
            end
    
            player2Hotstreak = 0
            player2HotstreakImage1:Hide()
            player2HotstreakImage2:Hide()
            player2HotstreakImage3:Hide()
            player2HotstreakImage4:Hide()
            player2HotstreakImage5:Hide()
            player2HotstreakImage6:Hide()
            player2HotstreakImage7:Hide()
            player2HotstreakImage8:Hide()
            player2HotstreakImage9:Hide()
            player2HotstreakImage10:Hide()
            player2HotstreakImage11:Hide()
            player2HotstreakImage12:Hide()
            player2HotstreakImage13:Hide()
            player2HotstreakImage14:Hide()
            player2HotstreakImage15:Hide()

            player2totalBetAmount = 0
            player2totalWin = 0
            player2totalLoss = 0
            player2totalProfit = 0
            player2TotalBankrollAmount = 0
    
            -- Reset banking information for the leaving player
            unitName2 = nil
            player2Name = nil

            if playerName == playerGettingKicked then
                local wageredString = historyFrame.player2totalWageredAmount:GetText()
                local wonString = historyFrame.player2totalWonAmount:GetText()
                local lostString = historyFrame.player2totalLostAmount:GetText()
                local profitString = historyFrame.player2ProfitAmount:GetText()
                local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()

                local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
                local wonAmount = tonumber(string.match(wonString, "(%d+)"))
                local lostAmount = tonumber(string.match(lostString, "(%d+)"))
                local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
                local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

                -- Store banking information for the leaving player
                if wageredAmount then
                    playerBankingInfo[playerName] = {
                        totalWagered = wageredAmount,
                        totalWon = wonAmount,
                        totalLost = lostAmount,
                        totalProfit = profitAmount,
                        bankrollTable = bankrollAmount,
                        bankrollCashDesk = bankrollAmount
                    }
                else
                    print("wageredAmount == nil")
                end
    
                historyFrame.player2totalWageredAmount:SetText("0 G")
                historyFrame.player2totalWonAmount:SetText("0 G")
                historyFrame.player2totalLostAmount:SetText("0 G")
                historyFrame.player2ProfitAmount:SetText("0 G")
                historyFrame.player2ProfitAmount:SetTextColor(1, 1, 1)

                player2dealtCardsFrame:Hide()
                player2dealtCardsFrameSplitH1:Hide()
                player2dealtCardsFrameSplitH2:Hide()
                player2PreloadBetButton:Hide()
                player2PreloadEditBoxMainBet:Hide()
                player2PreloadEditBoxPPBet:Hide()
                player2PreloadEditBox213Bet:Hide()
                playerFrame.leaveSeat2Button:Hide()
                playerFrame.player2HitButton:Hide()
                playerFrame.player2StandButton:Hide()
                playerFrame.player2DoubleButton:Hide()
                playerFrame.player2SplitButton:Hide()
                playerFrame.player2InsuranceYesButton:Hide()
                playerFrame.player2InsuranceNoButton:Hide()
                playerFrame.player2DealNowButton:Hide()
                player2ConfirmMainBetButton:Hide()
                player2ConfirmPPBetButton:Hide()
                player2Confirm213BetButton:Hide()
                player2MainBetEditBox:Hide()
                player2PPBetEditBox:Hide()
                player2213BetEditBox:Hide()
                playerFrame.player2MainBetTitle:Hide()
                playerFrame.player2PPBetTitle:Hide()
                playerFrame.player2213BetTitle:Hide()
                playerFrame.player2InsuranceTitle:Hide()
                playerFrame.player2InsuranceSubtitle:Hide()
                menuFrame.cardsButton:Disable()
                playerFrame.historyButton:Disable()
                menuFrame.preloadButton:Disable()
                playerFrame.cashDeskButton:Disable()
                playerFrame.takeSeat2Button:Show()
                if playerFrame.player1Name:GetText() == "Seat Empty" then    
                    playerFrame.takeSeat1Button:Enable()
                end
                if playerFrame.player3Name:GetText() == "Seat Empty" then  
                    playerFrame.takeSeat3Button:Enable()
                end
                if playerFrame.player4Name:GetText() == "Seat Empty" then 
                    playerFrame.takeSeat4Button:Enable()
                end
                if playerFrame.player5Name:GetText() == "Seat Empty" then
                    playerFrame.takeSeat5Button:Enable()
                end
                cashDeskFrame.player2TotalBankroll:Hide()
                historyFrame:Hide()
                preloadFrame:Hide()
                historyFrame.player2totalWageredAmount:Hide()
                historyFrame.player2totalWonAmount:Hide()
                historyFrame.player2totalLostAmount:Hide()
                historyFrame.player2ProfitAmount:Hide()
                bankrollFrame.player2TotalBankrollTableDisplay:Hide()
                bankrollFrame.BaseTextDisplay:Show()
                seatFrame:Hide()
                seatFrame.seat2:Hide()
            end

        elseif string.find(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+3%.?") then
            playerGettingKicked = string.match(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+3%.?")
            playerFrame.player3Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player4HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat3Button:Disable()
            else
                playerFrame.takeSeat3Button:Enable()
            end
    
            player3Hotstreak = 0
            player3HotstreakImage1:Hide()
            player3HotstreakImage2:Hide()
            player3HotstreakImage3:Hide()
            player3HotstreakImage4:Hide()
            player3HotstreakImage5:Hide()
            player3HotstreakImage6:Hide()
            player3HotstreakImage7:Hide()
            player3HotstreakImage8:Hide()
            player3HotstreakImage9:Hide()
            player3HotstreakImage10:Hide()
            player3HotstreakImage11:Hide()
            player3HotstreakImage12:Hide()
            player3HotstreakImage13:Hide()
            player3HotstreakImage14:Hide()
            player3HotstreakImage15:Hide()

            player3totalBetAmount = 0
            player3totalWin = 0
            player3totalLoss = 0
            player3totalProfit = 0
            player3TotalBankrollAmount = 0
    
            -- Reset banking information for the leaving player
            unitName3 = nil
            player3Name = nil

            if playerName == playerGettingKicked then
                local wageredString = historyFrame.player3totalWageredAmount:GetText()
                local wonString = historyFrame.player3totalWonAmount:GetText()
                local lostString = historyFrame.player3totalLostAmount:GetText()
                local profitString = historyFrame.player3ProfitAmount:GetText()
                local bankrollString = bankrollFrame.player3TotalBankrollTableDisplay:GetText()

                local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
                local wonAmount = tonumber(string.match(wonString, "(%d+)"))
                local lostAmount = tonumber(string.match(lostString, "(%d+)"))
                local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
                local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

                -- Store banking information for the leaving player
                if wageredAmount then
                    playerBankingInfo[playerName] = {
                        totalWagered = wageredAmount,
                        totalWon = wonAmount,
                        totalLost = lostAmount,
                        totalProfit = profitAmount,
                        bankrollTable = bankrollAmount,
                        bankrollCashDesk = bankrollAmount
                    }
                else
                    print("wageredAmount == nil")
                end
    
                historyFrame.player3totalWageredAmount:SetText("0 G")
                historyFrame.player3totalWonAmount:SetText("0 G")
                historyFrame.player3totalLostAmount:SetText("0 G")
                historyFrame.player3ProfitAmount:SetText("0 G")
                historyFrame.player3ProfitAmount:SetTextColor(1, 1, 1)

                player3dealtCardsFrame:Hide()
                player3dealtCardsFrameSplitH1:Hide()
                player3dealtCardsFrameSplitH2:Hide()
                player3PreloadBetButton:Hide()
                player3PreloadEditBoxMainBet:Hide()
                player3PreloadEditBoxPPBet:Hide()
                player3PreloadEditBox213Bet:Hide()
                playerFrame.leaveSeat3Button:Hide()
                playerFrame.player3HitButton:Hide()
                playerFrame.player3StandButton:Hide()
                playerFrame.player3DoubleButton:Hide()
                playerFrame.player3SplitButton:Hide()
                playerFrame.player3InsuranceYesButton:Hide()
                playerFrame.player3InsuranceNoButton:Hide()
                playerFrame.player3DealNowButton:Hide()
                player3ConfirmMainBetButton:Hide()
                player3ConfirmPPBetButton:Hide()
                player3Confirm213BetButton:Hide()
                player3MainBetEditBox:Hide()
                player3PPBetEditBox:Hide()
                player3213BetEditBox:Hide()
                playerFrame.player3MainBetTitle:Hide()
                playerFrame.player3PPBetTitle:Hide()
                playerFrame.player3213BetTitle:Hide()
                playerFrame.player3InsuranceTitle:Hide()
                playerFrame.player3InsuranceSubtitle:Hide()
                menuFrame.cardsButton:Disable()
                playerFrame.historyButton:Disable()
                menuFrame.preloadButton:Disable()
                playerFrame.cashDeskButton:Disable()
                playerFrame.takeSeat3Button:Show()
                if playerFrame.player1Name:GetText() == "Seat Empty" then    
                    playerFrame.takeSeat1Button:Enable()
                end
                if playerFrame.player2Name:GetText() == "Seat Empty" then  
                    playerFrame.takeSeat2Button:Enable()
                end
                if playerFrame.player4Name:GetText() == "Seat Empty" then 
                    playerFrame.takeSeat4Button:Enable()
                end
                if playerFrame.player5Name:GetText() == "Seat Empty" then
                    playerFrame.takeSeat5Button:Enable()
                end
                cashDeskFrame.player3TotalBankroll:Hide()
                historyFrame:Hide()
                preloadFrame:Hide()
                historyFrame.player3totalWageredAmount:Hide()
                historyFrame.player3totalWonAmount:Hide()
                historyFrame.player3totalLostAmount:Hide()
                historyFrame.player3ProfitAmount:Hide()
                bankrollFrame.player3TotalBankrollTableDisplay:Hide()
                bankrollFrame.BaseTextDisplay:Show()
                seatFrame:Hide()
                seatFrame.seat3:Hide()
            end

        elseif string.find(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+4%.?") then
            playerGettingKicked = string.match(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+4%.?")
            playerFrame.player4Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player5HitButton:IsShown() then
                playerFrame.takeSeat4Button:Disable()
            else
                playerFrame.takeSeat4Button:Enable()
            end
    
            player4Hotstreak = 0
            player4HotstreakImage1:Hide()
            player4HotstreakImage2:Hide()
            player4HotstreakImage3:Hide()
            player4HotstreakImage4:Hide()
            player4HotstreakImage5:Hide()
            player4HotstreakImage6:Hide()
            player4HotstreakImage7:Hide()
            player4HotstreakImage8:Hide()
            player4HotstreakImage9:Hide()
            player4HotstreakImage10:Hide()
            player4HotstreakImage11:Hide()
            player4HotstreakImage12:Hide()
            player4HotstreakImage13:Hide()
            player4HotstreakImage14:Hide()
            player4HotstreakImage15:Hide()

            player4totalBetAmount = 0
            player4totalWin = 0
            player4totalLoss = 0
            player4totalProfit = 0
            player4TotalBankrollAmount = 0
    
            -- Reset banking information for the leaving player
            unitName4 = nil
            player4Name = nil

            if playerName == playerGettingKicked then
                local wageredString = historyFrame.player4totalWageredAmount:GetText()
                local wonString = historyFrame.player4totalWonAmount:GetText()
                local lostString = historyFrame.player4totalLostAmount:GetText()
                local profitString = historyFrame.player4ProfitAmount:GetText()
                local bankrollString = bankrollFrame.player4TotalBankrollTableDisplay:GetText()

                local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
                local wonAmount = tonumber(string.match(wonString, "(%d+)"))
                local lostAmount = tonumber(string.match(lostString, "(%d+)"))
                local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
                local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

                -- Store banking information for the leaving player
                if wageredAmount then
                    playerBankingInfo[playerName] = {
                        totalWagered = wageredAmount,
                        totalWon = wonAmount,
                        totalLost = lostAmount,
                        totalProfit = profitAmount,
                        bankrollTable = bankrollAmount,
                        bankrollCashDesk = bankrollAmount
                    }
                else
                    print("wageredAmount == nil")
                end
    
                historyFrame.player4totalWageredAmount:SetText("0 G")
                historyFrame.player4totalWonAmount:SetText("0 G")
                historyFrame.player4totalLostAmount:SetText("0 G")
                historyFrame.player4ProfitAmount:SetText("0 G")
                historyFrame.player4ProfitAmount:SetTextColor(1, 1, 1)

                player4dealtCardsFrame:Hide()
                player4dealtCardsFrameSplitH1:Hide()
                player4dealtCardsFrameSplitH2:Hide()
                player4PreloadBetButton:Hide()
                player4PreloadEditBoxMainBet:Hide()
                player4PreloadEditBoxPPBet:Hide()
                player4PreloadEditBox213Bet:Hide()
                playerFrame.leaveSeat4Button:Hide()
                playerFrame.player4HitButton:Hide()
                playerFrame.player4StandButton:Hide()
                playerFrame.player4DoubleButton:Hide()
                playerFrame.player4SplitButton:Hide()
                playerFrame.player4InsuranceYesButton:Hide()
                playerFrame.player4InsuranceNoButton:Hide()
                playerFrame.player4DealNowButton:Hide()
                player4ConfirmMainBetButton:Hide()
                player4ConfirmPPBetButton:Hide()
                player4Confirm213BetButton:Hide()
                player4MainBetEditBox:Hide()
                player4PPBetEditBox:Hide()
                player4213BetEditBox:Hide()
                playerFrame.player4MainBetTitle:Hide()
                playerFrame.player4PPBetTitle:Hide()
                playerFrame.player4213BetTitle:Hide()
                playerFrame.player4InsuranceTitle:Hide()
                playerFrame.player4InsuranceSubtitle:Hide()
                menuFrame.cardsButton:Disable()
                playerFrame.historyButton:Disable()
                menuFrame.preloadButton:Disable()
                playerFrame.cashDeskButton:Disable()
                playerFrame.takeSeat4Button:Show()
                if playerFrame.player1Name:GetText() == "Seat Empty" then    
                    playerFrame.takeSeat1Button:Enable()
                end
                if playerFrame.player2Name:GetText() == "Seat Empty" then  
                    playerFrame.takeSeat2Button:Enable()
                end
                if playerFrame.player3Name:GetText() == "Seat Empty" then 
                    playerFrame.takeSeat3Button:Enable()
                end
                if playerFrame.player5Name:GetText() == "Seat Empty" then
                    playerFrame.takeSeat5Button:Enable()
                end
                cashDeskFrame.player4TotalBankroll:Hide()
                historyFrame:Hide()
                preloadFrame:Hide()
                historyFrame.player4totalWageredAmount:Hide()
                historyFrame.player4totalWonAmount:Hide()
                historyFrame.player4totalLostAmount:Hide()
                historyFrame.player4ProfitAmount:Hide()
                bankrollFrame.player4TotalBankrollTableDisplay:Hide()
                bankrollFrame.BaseTextDisplay:Show()
                seatFrame:Hide()
                seatFrame.seat4:Hide()
            end

        elseif string.find(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+5%.?") then
            playerGettingKicked = string.match(message, "{circle}%s+(%S+)%s+has%s+been%s+kicked%s+from%s+Seat%s+5%.?")
            playerFrame.player5Name:SetText("Seat Empty")
            if playerFrame.player1HitButton:IsShown() or playerFrame.player2HitButton:IsShown() or playerFrame.player3HitButton:IsShown() or playerFrame.player4HitButton:IsShown() then
                playerFrame.takeSeat5Button:Disable()
            else
                playerFrame.takeSeat5Button:Enable()
            end
    
            player5Hotstreak = 0
            player5HotstreakImage1:Hide()
            player5HotstreakImage2:Hide()
            player5HotstreakImage3:Hide()
            player5HotstreakImage4:Hide()
            player5HotstreakImage5:Hide()
            player5HotstreakImage6:Hide()
            player5HotstreakImage7:Hide()
            player5HotstreakImage8:Hide()
            player5HotstreakImage9:Hide()
            player5HotstreakImage10:Hide()
            player5HotstreakImage11:Hide()
            player5HotstreakImage12:Hide()
            player5HotstreakImage13:Hide()
            player5HotstreakImage14:Hide()
            player5HotstreakImage15:Hide()

            player5totalBetAmount = 0
            player5totalWin = 0
            player5totalLoss = 0
            player5totalProfit = 0
            player5TotalBankrollAmount = 0
    
            -- Reset banking information for the leaving player
            unitName5 = nil
            player5Name = nil

            if playerName == playerGettingKicked then
                local wageredString = historyFrame.player5totalWageredAmount:GetText()
                local wonString = historyFrame.player5totalWonAmount:GetText()
                local lostString = historyFrame.player5totalLostAmount:GetText()
                local profitString = historyFrame.player5ProfitAmount:GetText()
                local bankrollString = bankrollFrame.player5TotalBankrollTableDisplay:GetText()

                local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
                local wonAmount = tonumber(string.match(wonString, "(%d+)"))
                local lostAmount = tonumber(string.match(lostString, "(%d+)"))
                local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
                local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

                -- Store banking information for the leaving player
                if wageredAmount then
                    playerBankingInfo[playerName] = {
                        totalWagered = wageredAmount,
                        totalWon = wonAmount,
                        totalLost = lostAmount,
                        totalProfit = profitAmount,
                        bankrollTable = bankrollAmount,
                        bankrollCashDesk = bankrollAmount
                    }
                else
                    print("wageredAmount == nil")
                end
    
                historyFrame.player5totalWageredAmount:SetText("0 G")
                historyFrame.player5totalWonAmount:SetText("0 G")
                historyFrame.player5totalLostAmount:SetText("0 G")
                historyFrame.player5ProfitAmount:SetText("0 G")
                historyFrame.player5ProfitAmount:SetTextColor(1, 1, 1)

                player5dealtCardsFrame:Hide()
                player5dealtCardsFrameSplitH1:Hide()
                player5dealtCardsFrameSplitH2:Hide()
                player5PreloadBetButton:Hide()
                player5PreloadEditBoxMainBet:Hide()
                player5PreloadEditBoxPPBet:Hide()
                player5PreloadEditBox213Bet:Hide()
                playerFrame.leaveSeat5Button:Hide()
                playerFrame.player5HitButton:Hide()
                playerFrame.player5StandButton:Hide()
                playerFrame.player5DoubleButton:Hide()
                playerFrame.player5SplitButton:Hide()
                playerFrame.player5InsuranceYesButton:Hide()
                playerFrame.player5InsuranceNoButton:Hide()
                playerFrame.player5DealNowButton:Hide()
                player5ConfirmMainBetButton:Hide()
                player5ConfirmPPBetButton:Hide()
                player5Confirm213BetButton:Hide()
                player5MainBetEditBox:Hide()
                player5PPBetEditBox:Hide()
                player5213BetEditBox:Hide()
                playerFrame.player5MainBetTitle:Hide()
                playerFrame.player5PPBetTitle:Hide()
                playerFrame.player5213BetTitle:Hide()
                playerFrame.player5InsuranceTitle:Hide()
                playerFrame.player5InsuranceSubtitle:Hide()
                menuFrame.cardsButton:Disable()
                playerFrame.historyButton:Disable()
                menuFrame.preloadButton:Disable()
                playerFrame.cashDeskButton:Disable()
                playerFrame.takeSeat5Button:Show()
                if playerFrame.player1Name:GetText() == "Seat Empty" then    
                    playerFrame.takeSeat1Button:Enable()
                end
                if playerFrame.player2Name:GetText() == "Seat Empty" then  
                    playerFrame.takeSeat2Button:Enable()
                end
                if playerFrame.player3Name:GetText() == "Seat Empty" then 
                    playerFrame.takeSeat3Button:Enable()
                end
                if playerFrame.player4Name:GetText() == "Seat Empty" then
                    playerFrame.takeSeat4Button:Enable()
                end
                cashDeskFrame.player5TotalBankroll:Hide()
                historyFrame:Hide()
                preloadFrame:Hide()
                historyFrame.player5totalWageredAmount:Hide()
                historyFrame.player5totalWonAmount:Hide()
                historyFrame.player5totalLostAmount:Hide()
                historyFrame.player5ProfitAmount:Hide()
                bankrollFrame.player5TotalBankrollTableDisplay:Hide()
                bankrollFrame.BaseTextDisplay:Show()
                seatFrame:Hide()
                seatFrame.seat5:Hide()
            end

        elseif message == "I have closed the table." then
            PlayerFrameHide()
            resetHistory()
        elseif message == "I have started a new round." then
            betReset()
            RemoveCardTextures()
        elseif message == "{diamond} Insurance is available." then
            insuranceAvailable()
        elseif string.find(message, "{triangle} Split is available") then
            if unitName1 and string.find(message, unitName1) then
                playerFrame.player1SplitButton:Enable()
            elseif unitName2 and string.find(message, unitName2) then
                playerFrame.player2SplitButton:Enable()
            elseif unitName3 and string.find(message, unitName3) then
                playerFrame.player3SplitButton:Enable()
            elseif unitName4 and string.find(message, unitName4) then
                playerFrame.player4SplitButton:Enable()
            elseif unitName5 and string.find(message, unitName5) then
                playerFrame.player5SplitButton:Enable()
            end
        elseif string.find(message, "Main Bet: Min:") then
            usingThisToAvoidUpvalues1 = tonumber(string.match(message, "(%d+)G"))
            minBetMain = usingThisToAvoidUpvalues1
        elseif string.find(message, "Main Bet: Max:") then
            usingThisToAvoidUpvalues2 = tonumber(string.match(message, "(%d+)G"))
            maxBetMain = usingThisToAvoidUpvalues2
        elseif string.find(message, "Side Bets: Min:") then
            usingThisToAvoidUpvalues3 = tonumber(string.match(message, "(%d+)G"))
            minBetPP = usingThisToAvoidUpvalues3
            minBet213 = usingThisToAvoidUpvalues3
        elseif string.find(message, "Side Bets: Max:") then
            usingThisToAvoidUpvalues4 = tonumber(string.match(message, "(%d+)G"))
            maxBetPP = usingThisToAvoidUpvalues4
            maxBet213 = usingThisToAvoidUpvalues4
            tableLimitsMainText:SetText(minBetMain .. "G  -  " .. maxBetMain .."G")
            tableLimitsSideText:SetText(minBetPP .. "G  -  " .. maxBetPP .."G")
        elseif string.find(message, "Switching to a 1%-deck shoe") then
            numberOfDecksInShoeText:SetText("1     (52 cards total)")
        elseif string.find(message, "Switching to a 2%-deck shoe") then
            numberOfDecksInShoeText:SetText("2     (104 cards total)")
        elseif string.find(message, "Switching to a 3%-deck shoe") then
            numberOfDecksInShoeText:SetText("3     (156 cards total)")
        elseif string.find(message, "Switching to a 4%-deck shoe") then
            numberOfDecksInShoeText:SetText("4     (208 cards total)")
        elseif string.find(message, "Switching to a 5%-deck shoe") then
            numberOfDecksInShoeText:SetText("5     (260 cards total)")
        elseif string.find(message, "Switching to a 6%-deck shoe") then
            numberOfDecksInShoeText:SetText("6     (312 cards total)")
        elseif string.find(message, "Switching to a 7%-deck shoe") then
            numberOfDecksInShoeText:SetText("7     (364 cards total)")
        elseif string.find(message, "Switching to a 8%-deck shoe") then
            numberOfDecksInShoeText:SetText("8     (416 cards total)")
        elseif message == "{star} Place your bets! You have 30 seconds." then
            StartCountdownTimerBets()
        elseif string.find(message, "added") then
            if string.find(message, playerName) then
                if playerName == unitName1 then
                    PlaySoundFile(soundFilePaths[115])
                    local additionalBankrollAmountString = string.match(message, "([%d%.]+)G") 
                    if additionalBankrollAmountString then
                        local additionalBankrollAmount = tonumber(additionalBankrollAmountString)
                        if additionalBankrollAmount then
                            player1TotalBankrollAmount = player1TotalBankrollAmount + additionalBankrollAmount
                            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
                            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player1TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName2 then
                    PlaySoundFile(soundFilePaths[115])
                    local additionalBankrollAmountString = string.match(message, "([%d%.]+)G") 
                    if additionalBankrollAmountString then
                        local additionalBankrollAmount = tonumber(additionalBankrollAmountString)
                        if additionalBankrollAmount then
                            player2TotalBankrollAmount = player2TotalBankrollAmount + additionalBankrollAmount
                            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
                            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName3 then
                    PlaySoundFile(soundFilePaths[115])
                    local additionalBankrollAmountString = string.match(message, "([%d%.]+)G") 
                    if additionalBankrollAmountString then
                        local additionalBankrollAmount = tonumber(additionalBankrollAmountString)
                        if additionalBankrollAmount then
                            player3TotalBankrollAmount = player3TotalBankrollAmount + additionalBankrollAmount
                            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
                            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player3TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName4 then
                    PlaySoundFile(soundFilePaths[115])
                    local additionalBankrollAmountString = string.match(message, "([%d%.]+)G") 
                    if additionalBankrollAmountString then
                        local additionalBankrollAmount = tonumber(additionalBankrollAmountString)
                        if additionalBankrollAmount then
                            player4TotalBankrollAmount = player4TotalBankrollAmount + additionalBankrollAmount
                            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
                            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player4TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName5 then
                    PlaySoundFile(soundFilePaths[115])
                    local additionalBankrollAmountString = string.match(message, "([%d%.]+)G") 
                    if additionalBankrollAmountString then
                        local additionalBankrollAmount = tonumber(additionalBankrollAmountString)
                        if additionalBankrollAmount then
                            player5TotalBankrollAmount = player5TotalBankrollAmount + additionalBankrollAmount
                            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
                            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player5TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                end
            end
        elseif string.find(message, "withdrew") then
            if string.find(message, playerName) then
                if playerName == unitName1 then
                    local removalBankrollAmountString = string.match(message, "([%d%.]+)G")
                    if removalBankrollAmountString then
                        local removalBankrollAmount = tonumber(removalBankrollAmountString)
                        if removalBankrollAmount then
                            player1TotalBankrollAmount = player1TotalBankrollAmount - removalBankrollAmount
                            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
                            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player1TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName2 then
                    local removalBankrollAmountString = string.match(message, "([%d%.]+)G")
                    if removalBankrollAmountString then
                        local removalBankrollAmount = tonumber(removalBankrollAmountString)
                        if removalBankrollAmount then
                            player2TotalBankrollAmount = player2TotalBankrollAmount - removalBankrollAmount
                            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
                            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName3 then
                    local removalBankrollAmountString = string.match(message, "([%d%.]+)G")
                    if removalBankrollAmountString then
                        local removalBankrollAmount = tonumber(removalBankrollAmountString)
                        if removalBankrollAmount then
                            player3TotalBankrollAmount = player3TotalBankrollAmount - removalBankrollAmount
                            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
                            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player3TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName4 then
                    local removalBankrollAmountString = string.match(message, "([%d%.]+)G")
                    if removalBankrollAmountString then
                        local removalBankrollAmount = tonumber(removalBankrollAmountString)
                        if removalBankrollAmount then
                            player4TotalBankrollAmount = player4TotalBankrollAmount - removalBankrollAmount
                            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
                            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player4TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                elseif playerName == unitName5 then
                    local removalBankrollAmountString = string.match(message, "([%d%.]+)G")
                    if removalBankrollAmountString then
                        local removalBankrollAmount = tonumber(removalBankrollAmountString)
                        if removalBankrollAmount then
                            player5TotalBankrollAmount = player5TotalBankrollAmount - removalBankrollAmount
                            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
                            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
                            local bankrollString = bankrollFrame.player5TotalBankrollTableDisplay:GetText()
                            local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))
                            playerBankingInfo[playerName] = {
                                bankrollTable = bankrollAmount,
                                bankrollCashDesk = bankrollAmount
                            }
                        end
                    end
                end
            end
        elseif string.find(message, "received") then
            roundStarted()
            gameRunning = true
            PlaySoundFile(soundFilePaths[32])
            if unitName1 and string.find(message, unitName1) then

                player1dealtCardsFrame.notStartedYetText:Hide()

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then

                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 3 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[3]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[3]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 4 or turn == 23 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[4]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 5 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[5]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[6]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 7 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[7]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[8]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[4]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[5]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 or turn == 16 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[6]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[7]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[8]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[9]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[10]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 4]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 5]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then

                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 4 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 or turn == 25 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 7 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 or turn == 18 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 or turn == 24 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 5]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 4 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 or turn == 25 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 7 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 or turn == 18 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 or turn == 24 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 5]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 4 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 or turn == 25 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 7 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 or turn == 18 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 or turn == 24 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 5]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 4 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 or turn == 25 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 7 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 or turn == 18 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 or turn == 24 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 5]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 5 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 or turn == 27 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 or turn == 20 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 or turn == 26 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 5 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 or turn == 27 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 or turn == 20 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 or turn == 26 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 5 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 or turn == 27 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 or turn == 20 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 or turn == 26 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 5 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 or turn == 27 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 or turn == 20 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 or turn == 26 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end
                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 5 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 or turn == 27 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 or turn == 20 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 or turn == 26 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 5 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 8 or turn == 27 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 9 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 or turn == 20 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 or turn == 26 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 6]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 or turn == 29 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 or turn == 28 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 26 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 27 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 11]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 or turn == 29 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 or turn == 28 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 26 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 27 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 11]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 or turn == 29 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 or turn == 28 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 26 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 27 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 11]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 6 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 10 or turn == 29 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 11 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 or turn == 28 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 7]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 24 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 26 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 27 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 11]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if turn == 1 then -- Player 1: 1st Card
                        player1MainCardName1 = dealtCards[1]
                        player1MainCardFileName1 = GetCardFileName(player1MainCardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 7 then -- Player 1: 2nd Card
                        player1MainCardName2 = dealtCards[4]
                        player1MainCardFileName2 = GetCardFileName(player1MainCardName2)
                        player1H1CardName1 = dealtCards[1]
                        player1H1CardFileName1 = GetCardFileName(player1H1CardName1)
                        player1H2CardName1 = dealtCards[4]
                        player1H2CardFileName1 = GetCardFileName(player1H2CardName1)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 12 or turn == 31 then -- Player 1: 3rd Card or 3rd Card (Double)
                        player1MainCardName3 = dealtCards[6]
                        player1MainCardFileName3 = GetCardFileName(player1MainCardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 13 then -- Player 1: 4th Card
                        player1MainCardName4 = dealtCards[7]
                        player1MainCardFileName4 = GetCardFileName(player1MainCardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 14 then -- Player 1: 5th Card
                        player1MainCardName5 = dealtCards[8]
                        player1MainCardFileName5 = GetCardFileName(player1MainCardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 15 then -- Player 1: 6th Card
                        player1MainCardName6 = dealtCards[9]
                        player1MainCardFileName6 = GetCardFileName(player1MainCardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 16 then -- Player 1: 7th Card
                        player1MainCardName7 = dealtCards[10]
                        player1MainCardFileName7 = GetCardFileName(player1MainCardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 17 then  -- Player 1: 2nd Card (Split H1)
                        player1H1CardName2 = dealtCards[6]
                        player1H1CardFileName2 = GetCardFileName(player1H1CardName2)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 2
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 18 then -- Player 1: 2nd Card (Split H2)
                        player1H2CardName2 = dealtCards[7]
                        player1H2CardFileName2 = GetCardFileName(player1H2CardName2)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 19 or turn == 24 then -- Player 1: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player1H1CardName3 = dealtCards[8]
                        player1H1CardFileName3 = GetCardFileName(player1H1CardName3)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 20 then -- Player 1: 4th Card (Split H1)
                        player1H1CardName4 = dealtCards[9]
                        player1H1CardFileName4 = GetCardFileName(player1H1CardName4)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 21 then -- Player 1: 5th Card (Split H1)
                        player1H1CardName5 = dealtCards[10]
                        player1H1CardFileName5 = GetCardFileName(player1H1CardName5)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 22 then -- Player 1: 6th Card (Split H1)
                        player1H1CardName6 = dealtCards[11]
                        player1H1CardFileName6 = GetCardFileName(player1H1CardName6)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 23 then -- Player 1: 7th Card (Split H1)
                        player1H1CardName7 = dealtCards[12]
                        player1H1CardFileName7 = GetCardFileName(player1H1CardName7)
                        player1NumberOfCardsH1 = player1NumberOfCardsH1 + 1
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 25 or turn == 30 then -- Player 1: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player1H2CardName3 = dealtCards[player1NumberOfCardsH1 + 8]
                        player1H2CardFileName3 = GetCardFileName(player1H2CardName3)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 26 then -- Player 1: 4th Card (Split H2)
                        player1H2CardName4 = dealtCards[player1NumberOfCardsH1 + 9]
                        player1H2CardFileName4 = GetCardFileName(player1H2CardName4)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 27 then -- Player 1: 5th Card (Split H2)
                        player1H2CardName5 = dealtCards[player1NumberOfCardsH1 + 10]
                        player1H2CardFileName5 = GetCardFileName(player1H2CardName5)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 28 then -- Player 1: 6th Card (Split H2)
                        player1H2CardName6 = dealtCards[player1NumberOfCardsH1 + 11]
                        player1H2CardFileName6 = GetCardFileName(player1H2CardName6)
                        player1NumberOfCards = player1NumberOfCards + 1
                    elseif turn == 29 then -- Player 1: 7th Card (Split H2)
                        player1H2CardName7 = dealtCards[player1NumberOfCardsH1 + 12]
                        player1H2CardFileName7 = GetCardFileName(player1H2CardName7)
                        player1NumberOfCards = player1NumberOfCards + 1
                    end
                end

                -- >> MAIN HAND <<
                -- >> MAIN HAND <<

                player1dealtCardsFrame.player1MainCardImage1:SetTexture(nil)
                player1dealtCardsFrame.player1MainCardImage1:Hide()
                player1dealtCardsFrame.player1MainCardImage2:SetTexture(nil)
                player1dealtCardsFrame.player1MainCardImage2:Hide()
                player1dealtCardsFrame.player1MainCardImage3:SetTexture(nil)
                player1dealtCardsFrame.player1MainCardImage3:Hide()
                player1dealtCardsFrame.player1MainCardImage4:SetTexture(nil)
                player1dealtCardsFrame.player1MainCardImage4:Hide()
                player1dealtCardsFrame.player1MainCardImage5:SetTexture(nil)
                player1dealtCardsFrame.player1MainCardImage5:Hide()
                player1dealtCardsFrame.player1MainCardImage6:SetTexture(nil)
                player1dealtCardsFrame.player1MainCardImage6:Hide()
                player1dealtCardsFrame.player1MainCardImage7:SetTexture(nil)
                player1dealtCardsFrame.player1MainCardImage7:Hide()
                
                if player1MainCardName1 and player1MainCardFileName1 then
                    player1dealtCardsFrame.player1MainCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1MainCardFileName1)
                    player1dealtCardsFrame.player1MainCardImage1:Show()
                    player1dealtCardsFrame.playerFirstCardText:Show()
                end
                if player1MainCardName2 and player1MainCardFileName2 then
                    player1dealtCardsFrame.player1MainCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1MainCardFileName2)
                    player1dealtCardsFrame.player1MainCardImage2:Show()
                    player1dealtCardsFrame.playerSecondCardText:Show()
                end
                if player1MainCardName3 and player1MainCardFileName3 then
                    player1dealtCardsFrame.player1MainCardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1MainCardFileName3)
                    player1dealtCardsFrame.player1MainCardImage3:Show()
                    player1dealtCardsFrame.playerThirdCardText:Show()
                end
                if player1MainCardName4 and player1MainCardFileName4 then
                    player1dealtCardsFrame.player1MainCardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1MainCardFileName4)
                    player1dealtCardsFrame.player1MainCardImage4:Show()
                    player1dealtCardsFrame.playerFourthCardText:Show()
                end
                if player1MainCardName5 and player1MainCardFileName5 then
                    player1dealtCardsFrame.player1MainCardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1MainCardFileName5)
                    player1dealtCardsFrame.player1MainCardImage5:Show()
                    player1dealtCardsFrame.playerFifthCardText:Show()
                end
                if player1MainCardName6 and player1MainCardFileName6 then
                    player1dealtCardsFrame.player1MainCardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1MainCardFileName6)
                    player1dealtCardsFrame.player1MainCardImage6:Show()
                    player1dealtCardsFrame.playerSixthCardText:Show()
                end
                if player1MainCardName7 and player1MainCardFileName7 then
                    player1dealtCardsFrame.player1MainCardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1MainCardFileName7)
                    player1dealtCardsFrame.player1MainCardImage7:Show()
                    player1dealtCardsFrame.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 1 <<
                -- >> SPLIT HAND 1 <<

                player1dealtCardsFrameSplitH1.player1H1CardImage1:SetTexture(nil)
                player1dealtCardsFrameSplitH1.player1H1CardImage1:Hide()
                player1dealtCardsFrameSplitH1.player1H1CardImage2:SetTexture(nil)
                player1dealtCardsFrameSplitH1.player1H1CardImage2:Hide()
                player1dealtCardsFrameSplitH1.player1H1CardImage3:SetTexture(nil)
                player1dealtCardsFrameSplitH1.player1H1CardImage3:Hide()
                player1dealtCardsFrameSplitH1.player1H1CardImage4:SetTexture(nil)
                player1dealtCardsFrameSplitH1.player1H1CardImage4:Hide()
                player1dealtCardsFrameSplitH1.player1H1CardImage5:SetTexture(nil)
                player1dealtCardsFrameSplitH1.player1H1CardImage5:Hide()
                player1dealtCardsFrameSplitH1.player1H1CardImage6:SetTexture(nil)
                player1dealtCardsFrameSplitH1.player1H1CardImage6:Hide()
                player1dealtCardsFrameSplitH1.player1H1CardImage7:SetTexture(nil)
                player1dealtCardsFrameSplitH1.player1H1CardImage7:Hide()

                if player1H1CardName1 and player1H1CardFileName1 then
                    player1dealtCardsFrameSplitH1.player1H1CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H1CardFileName1)
                    player1dealtCardsFrameSplitH1.player1H1CardImage1:Show()
                    player1dealtCardsFrameSplitH1.playerFirstCardText:Show()
                end
                if player1H1CardName2 and player1H1CardFileName2 then
                    player1dealtCardsFrameSplitH1.player1H1CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H1CardFileName2)
                    player1dealtCardsFrameSplitH1.player1H1CardImage2:Show()
                    player1dealtCardsFrameSplitH1.playerSecondCardText:Show()
                end
                if player1H1CardName3 and player1H1CardFileName3 then
                    player1dealtCardsFrameSplitH1.player1H1CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H1CardFileName3)
                    player1dealtCardsFrameSplitH1.player1H1CardImage3:Show()
                    player1dealtCardsFrameSplitH1.playerThirdCardText:Show()
                end
                if player1H1CardName4 and player1H1CardFileName4 then
                    player1dealtCardsFrameSplitH1.player1H1CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H1CardFileName4)
                    player1dealtCardsFrameSplitH1.player1H1CardImage4:Show()
                    player1dealtCardsFrameSplitH1.playerFourthCardText:Show()
                end
                if player1H1CardName5 and player1H1CardFileName5 then
                    player1dealtCardsFrameSplitH1.player1H1CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H1CardFileName5)
                    player1dealtCardsFrameSplitH1.player1H1CardImage5:Show()
                    player1dealtCardsFrameSplitH1.playerFifthCardText:Show()
                end
                if player1H1CardName6 and player1H1CardFileName6 then
                    player1dealtCardsFrameSplitH1.player1H1CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H1CardFileName6)
                    player1dealtCardsFrameSplitH1.player1H1CardImage6:Show()
                    player1dealtCardsFrameSplitH1.playerSixthCardText:Show()
                end
                if player1H1CardName7 and player1H1CardFileName7 then
                    player1dealtCardsFrameSplitH1.player1H1CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H1CardFileName7)
                    player1dealtCardsFrameSplitH1.player1H1CardImage7:Show()
                    player1dealtCardsFrameSplitH1.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 2 <<
                -- >> SPLIT HAND 2 <<

                player1dealtCardsFrameSplitH2.player1H2CardImage1:SetTexture(nil)
                player1dealtCardsFrameSplitH2.player1H2CardImage1:Hide()
                player1dealtCardsFrameSplitH2.player1H2CardImage2:SetTexture(nil)
                player1dealtCardsFrameSplitH2.player1H2CardImage2:Hide()
                player1dealtCardsFrameSplitH2.player1H2CardImage3:SetTexture(nil)
                player1dealtCardsFrameSplitH2.player1H2CardImage3:Hide()
                player1dealtCardsFrameSplitH2.player1H2CardImage4:SetTexture(nil)
                player1dealtCardsFrameSplitH2.player1H2CardImage4:Hide()
                player1dealtCardsFrameSplitH2.player1H2CardImage5:SetTexture(nil)
                player1dealtCardsFrameSplitH2.player1H2CardImage5:Hide()
                player1dealtCardsFrameSplitH2.player1H2CardImage6:SetTexture(nil)
                player1dealtCardsFrameSplitH2.player1H2CardImage6:Hide()
                player1dealtCardsFrameSplitH2.player1H2CardImage7:SetTexture(nil)
                player1dealtCardsFrameSplitH2.player1H2CardImage7:Hide()

                if player1H2CardName1 and player1H2CardFileName1 then
                    player1dealtCardsFrameSplitH2.player1H2CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H2CardFileName1)
                    player1dealtCardsFrameSplitH2.player1H2CardImage1:Show()
                    player1dealtCardsFrameSplitH2.playerFirstCardText:Show()
                end
                if player1H2CardName2 and player1H2CardFileName2 then
                    player1dealtCardsFrameSplitH2.player1H2CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H2CardFileName2)
                    player1dealtCardsFrameSplitH2.player1H2CardImage2:Show()
                    player1dealtCardsFrameSplitH2.playerSecondCardText:Show()
                end
                if player1H2CardName3 and player1H2CardFileName3 then
                    player1dealtCardsFrameSplitH2.player1H2CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H2CardFileName3)
                    player1dealtCardsFrameSplitH2.player1H2CardImage3:Show()
                    player1dealtCardsFrameSplitH2.playerThirdCardText:Show()
                end
                if player1H2CardName4 and player1H2CardFileName4 then
                    player1dealtCardsFrameSplitH2.player1H2CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H2CardFileName4)
                    player1dealtCardsFrameSplitH2.player1H2CardImage4:Show()
                    player1dealtCardsFrameSplitH2.playerFourthCardText:Show()
                end
                if player1H2CardName5 and player1H2CardFileName5 then
                    player1dealtCardsFrameSplitH2.player1H2CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H2CardFileName5)
                    player1dealtCardsFrameSplitH2.player1H2CardImage5:Show()
                    player1dealtCardsFrameSplitH2.playerFifthCardText:Show()
                end
                if player1H2CardName6 and player1H2CardFileName6 then
                    player1dealtCardsFrameSplitH2.player1H2CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H2CardFileName6)
                    player1dealtCardsFrameSplitH2.player1H2CardImage6:Show()
                    player1dealtCardsFrameSplitH2.playerSixthCardText:Show()
                end
                if player1H2CardName7 and player1H2CardFileName7 then
                    player1dealtCardsFrameSplitH2.player1H2CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1H2CardFileName7)
                    player1dealtCardsFrameSplitH2.player1H2CardImage7:Show()
                    player1dealtCardsFrameSplitH2.playerSeventhCardText:Show()
                end

            elseif unitName2 and string.find(message, unitName2) then

                player2dealtCardsFrame.notStartedYetText:Hide()
                
                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    if turn == 1 then -- Player 2: 1st Card
                        player2MainCardName1 = dealtCards[1]
                        player2MainCardFileName1 = GetCardFileName(player2MainCardName1)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 3 then -- Player 2: 2nd Card
                        player2MainCardName2 = dealtCards[3]
                        player2MainCardFileName2 = GetCardFileName(player2MainCardName2)
                        player2H1CardName1 = dealtCards[1]
                        player2H1CardFileName1 = GetCardFileName(player2H1CardName1)
                        player2H2CardName1 = dealtCards[3]
                        player2H2CardFileName1 = GetCardFileName(player2H2CardName1)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 4 or turn == 23 then -- Player 2: 3rd Card or 3rd Card (Double)
                        player2MainCardName3 = dealtCards[4]
                        player2MainCardFileName3 = GetCardFileName(player2MainCardName3)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 5 then -- Player 2: 4th Card
                        player2MainCardName4 = dealtCards[5]
                        player2MainCardFileName4 = GetCardFileName(player2MainCardName4)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 6 then -- Player 2: 5th Card
                        player2MainCardName5 = dealtCards[6]
                        player2MainCardFileName5 = GetCardFileName(player2MainCardName5)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 7 then -- Player 2: 6th Card
                        player2MainCardName6 = dealtCards[7]
                        player2MainCardFileName6 = GetCardFileName(player2MainCardName6)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 8 then -- Player 2: 7th Card
                        player2MainCardName7 = dealtCards[8]
                        player2MainCardFileName7 = GetCardFileName(player2MainCardName7)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 9 then  -- Player 2: 2nd Card (Split H1)
                        player2H1CardName2 = dealtCards[4]
                        player2H1CardFileName2 = GetCardFileName(player2H1CardName2)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 2
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 10 then -- Player 2: 2nd Card (Split H2)
                        player2H2CardName2 = dealtCards[5]
                        player2H2CardFileName2 = GetCardFileName(player2H2CardName2)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 11 or turn == 16 then -- Player 2: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player2H1CardName3 = dealtCards[6]
                        player2H1CardFileName3 = GetCardFileName(player2H1CardName3)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 12 then -- Player 2: 4th Card (Split H1)
                        player2H1CardName4 = dealtCards[7]
                        player2H1CardFileName4 = GetCardFileName(player2H1CardName4)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 13 then -- Player 2: 5th Card (Split H1)
                        player2H1CardName5 = dealtCards[8]
                        player2H1CardFileName5 = GetCardFileName(player2H1CardName5)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 14 then -- Player 2: 6th Card (Split H1)
                        player2H1CardName6 = dealtCards[9]
                        player2H1CardFileName6 = GetCardFileName(player2H1CardName6)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 15 then -- Player 2: 7th Card (Split H1)
                        player2H1CardName7 = dealtCards[10]
                        player2H1CardFileName7 = GetCardFileName(player2H1CardName7)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 2: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player2H2CardName3 = dealtCards[player2NumberOfCardsH1 + 4]
                        player2H2CardFileName3 = GetCardFileName(player2H2CardName3)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 18 then -- Player 2: 4th Card (Split H2)
                        player2H2CardName4 = dealtCards[player2NumberOfCardsH1 + 5]
                        player2H2CardFileName4 = GetCardFileName(player2H2CardName4)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 19 then -- Player 2: 5th Card (Split H2)
                        player2H2CardName5 = dealtCards[player2NumberOfCardsH1 + 6]
                        player2H2CardFileName5 = GetCardFileName(player2H2CardName5)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 20 then -- Player 2: 6th Card (Split H2)
                        player2H2CardName6 = dealtCards[player2NumberOfCardsH1 + 7]
                        player2H2CardFileName6 = GetCardFileName(player2H2CardName6)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 21 then -- Player 2: 7th Card (Split H2)
                        player2H2CardName7 = dealtCards[player2NumberOfCardsH1 + 8]
                        player2H2CardFileName7 = GetCardFileName(player2H2CardName7)
                        player2NumberOfCards = player2NumberOfCards + 1
                    end

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    if turn == 2 then -- Player 2: 1st Card
                        player2MainCardName1 = dealtCards[2]
                        player2MainCardFileName1 = GetCardFileName(player2MainCardName1)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 5 then -- Player 2: 2nd Card
                        player2MainCardName2 = dealtCards[5]
                        player2MainCardFileName2 = GetCardFileName(player2MainCardName2)
                        player2H1CardName1 = dealtCards[2]
                        player2H1CardFileName1 = GetCardFileName(player2H1CardName1)
                        player2H2CardName1 = dealtCards[5]
                        player2H2CardFileName1 = GetCardFileName(player2H2CardName1)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 26 or turn == 45 then -- Player 2: 3rd Card or 3rd Card (Double)
                        player2MainCardName3 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + 2]
                        player2MainCardFileName3 = GetCardFileName(player2MainCardName3)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 27 then -- Player 2: 4th Card
                        player2MainCardName4 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + 3]
                        player2MainCardFileName4 = GetCardFileName(player2MainCardName4)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 28 then -- Player 2: 5th Card
                        player2MainCardName5 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + 4]
                        player2MainCardFileName5 = GetCardFileName(player2MainCardName5)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 29 then -- Player 2: 6th Card
                        player2MainCardName6 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + 5]
                        player2MainCardFileName6 = GetCardFileName(player2MainCardName6)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 30 then -- Player 2: 7th Card
                        player2MainCardName7 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + 6]
                        player2MainCardFileName7 = GetCardFileName(player2MainCardName7)
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 31 then  -- Player 2: 2nd Card (Split H1)
                        player2H1CardName2 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards]
                        player2H1CardFileName2 = GetCardFileName(player2H1CardName2)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 2
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 32 then -- Player 2: 2nd Card (Split H2)
                        player2H2CardName2 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + player2NumberOfCardsH1 - 1]
                        player2H2CardFileName2 = GetCardFileName(player2H2CardName2)
                        player2NumberOfCardsH2 = player2NumberOfCardsH2 + 2
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 33 or turn == 38 then -- Player 2: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player2H1CardName3 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + 1]
                        player2H1CardFileName3 = GetCardFileName(player2H1CardName3)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 34 then -- Player 2: 4th Card (Split H1)
                        player2H1CardName4 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + 2]
                        player2H1CardFileName4 = GetCardFileName(player2H1CardName4)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 35 then -- Player 2: 5th Card (Split H1)
                        player2H1CardName5 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + 3]
                        player2H1CardFileName5 = GetCardFileName(player2H1CardName5)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 36 then -- Player 2: 6th Card (Split H1)
                        player2H1CardName6 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + 4]
                        player2H1CardFileName6 = GetCardFileName(player2H1CardName6)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 37 then -- Player 2: 7th Card (Split H1)
                        player2H1CardName7 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + 5]
                        player2H1CardFileName7 = GetCardFileName(player2H1CardName7)
                        player2NumberOfCardsH1 = player2NumberOfCardsH1 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 39 or turn == 44 then -- Player 2: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player2H2CardName3 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + player2NumberOfCardsH1]
                        player2H2CardFileName3 = GetCardFileName(player2H2CardName3)
                        player2NumberOfCardsH2 = player2NumberOfCardsH2 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 40 then -- Player 2: 4th Card (Split H2)
                        player2H2CardName4 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + player2NumberOfCardsH1 + 1]
                        player2H2CardFileName4 = GetCardFileName(player2H2CardName4)
                        player2NumberOfCardsH2 = player2NumberOfCardsH2 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 41 then -- Player 2: 5th Card (Split H2)
                        player2H2CardName5 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + player2NumberOfCardsH1 + 2]
                        player2H2CardFileName5 = GetCardFileName(player2H2CardName5)
                        player2NumberOfCardsH2 = player2NumberOfCardsH2 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 42 then -- Player 2: 6th Card (Split H2)
                        player2H2CardName6 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + player2NumberOfCardsH1 + 3]
                        player2H2CardFileName6 = GetCardFileName(player2H2CardName6)
                        player2NumberOfCardsH2 = player2NumberOfCardsH2 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    elseif turn == 43 then -- Player 2: 7th Card (Split H2)
                        player2H2CardName7 = dealtCards[player1NumberOfCards + player1NumberOfCardsH1 + player1NumberOfCardsH2 + player2NumberOfCards + player2NumberOfCardsH1 + 4]
                        player2H2CardFileName7 = GetCardFileName(player2H2CardName7)
                        player2NumberOfCardsH2 = player2NumberOfCardsH2 + 1
                        player2NumberOfCards = player2NumberOfCards + 1
                    end

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    
                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                
                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
              
                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
               
                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
               
                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                 
                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                 
                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                   

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
               
                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                
                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                 
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                
                end

                -- >> MAIN HAND <<
                -- >> MAIN HAND <<

                if player2MainCardName1 and player2MainCardFileName1 then
                    player2dealtCardsFrame.player2MainCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2MainCardFileName1)
                    player2dealtCardsFrame.player2MainCardImage1:Show()
                    player2dealtCardsFrame.playerFirstCardText:Show()
                end
                if player2MainCardName2 and player2MainCardFileName2 then
                    player2dealtCardsFrame.player2MainCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2MainCardFileName2)
                    player2dealtCardsFrame.player2MainCardImage2:Show()
                    player2dealtCardsFrame.playerSecondCardText:Show()
                end
                if player2MainCardName3 and player2MainCardFileName3 then
                    player2dealtCardsFrame.player2MainCardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2MainCardFileName3)
                    player2dealtCardsFrame.player2MainCardImage3:Show()
                    player2dealtCardsFrame.playerThirdCardText:Show()
                end
                if player2MainCardName4 and player2MainCardFileName4 then
                    player2dealtCardsFrame.player2MainCardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2MainCardFileName4)
                    player2dealtCardsFrame.player2MainCardImage4:Show()
                    player2dealtCardsFrame.playerFourthCardText:Show()
                end
                if player2MainCardName5 and player2MainCardFileName5 then
                    player2dealtCardsFrame.player2MainCardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2MainCardFileName5)
                    player2dealtCardsFrame.player2MainCardImage5:Show()
                    player2dealtCardsFrame.playerFifthCardText:Show()
                end
                if player2MainCardName6 and player2MainCardFileName6 then
                    player2dealtCardsFrame.player2MainCardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2MainCardFileName6)
                    player2dealtCardsFrame.player2MainCardImage6:Show()
                    player2dealtCardsFrame.playerSixthCardText:Show()
                end
                if player2MainCardName7 and player2MainCardFileName7 then
                    player2dealtCardsFrame.player2MainCardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2MainCardFileName7)
                    player2dealtCardsFrame.player2MainCardImage7:Show()
                    player2dealtCardsFrame.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 1 <<
                -- >> SPLIT HAND 1 <<

                if player2H1CardName1 and player2H1CardFileName1 then
                    player2dealtCardsFrameSplitH1.player2H1CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H1CardFileName1)
                    player2dealtCardsFrameSplitH1.player2H1CardImage1:Show()
                    player2dealtCardsFrameSplitH1.playerFirstCardText:Show()
                end
                if player2H1CardName2 and player2H1CardFileName2 then
                    player2dealtCardsFrameSplitH1.player2H1CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H1CardFileName2)
                    player2dealtCardsFrameSplitH1.player2H1CardImage2:Show()
                    player2dealtCardsFrameSplitH1.playerSecondCardText:Show()
                end
                if player2H1CardName3 and player2H1CardFileName3 then
                    player2dealtCardsFrameSplitH1.player2H1CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H1CardFileName3)
                    player2dealtCardsFrameSplitH1.player2H1CardImage3:Show()
                    player2dealtCardsFrameSplitH1.playerThirdCardText:Show()
                end
                if player2H1CardName4 and player2H1CardFileName4 then
                    player2dealtCardsFrameSplitH1.player2H1CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H1CardFileName4)
                    player2dealtCardsFrameSplitH1.player2H1CardImage4:Show()
                    player2dealtCardsFrameSplitH1.playerFourthCardText:Show()
                end
                if player2H1CardName5 and player2H1CardFileName5 then
                    player2dealtCardsFrameSplitH1.player2H1CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H1CardFileName5)
                    player2dealtCardsFrameSplitH1.player2H1CardImage5:Show()
                    player2dealtCardsFrameSplitH1.playerFifthCardText:Show()
                end
                if player2H1CardName6 and player2H1CardFileName6 then
                    player2dealtCardsFrameSplitH1.player2H1CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H1CardFileName6)
                    player2dealtCardsFrameSplitH1.player2H1CardImage6:Show()
                    player2dealtCardsFrameSplitH1.playerSixthCardText:Show()
                end
                if player2H1CardName7 and player2H1CardFileName7 then
                    player2dealtCardsFrameSplitH1.player2H1CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H1CardFileName7)
                    player2dealtCardsFrameSplitH1.player2H1CardImage7:Show()
                    player2dealtCardsFrameSplitH1.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 2 <<
                -- >> SPLIT HAND 2 <<

                if player2H2CardName1 and player2H2CardFileName1 then
                    player2dealtCardsFrameSplitH2.player2H2CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H2CardFileName1)
                    player2dealtCardsFrameSplitH2.player2H2CardImage1:Show()
                    player2dealtCardsFrameSplitH2.playerFirstCardText:Show()
                end
                if player2H2CardName2 and player2H2CardFileName2 then
                    player2dealtCardsFrameSplitH2.player2H2CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H2CardFileName2)
                    player2dealtCardsFrameSplitH2.player2H2CardImage2:Show()
                    player2dealtCardsFrameSplitH2.playerSecondCardText:Show()
                end
                if player2H2CardName3 and player2H2CardFileName3 then
                    player2dealtCardsFrameSplitH2.player2H2CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H2CardFileName3)
                    player2dealtCardsFrameSplitH2.player2H2CardImage3:Show()
                    player2dealtCardsFrameSplitH2.playerThirdCardText:Show()
                end
                if player2H2CardName4 and player2H2CardFileName4 then
                    player2dealtCardsFrameSplitH2.player2H2CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H2CardFileName4)
                    player2dealtCardsFrameSplitH2.player2H2CardImage4:Show()
                    player2dealtCardsFrameSplitH2.playerFourthCardText:Show()
                end
                if player2H2CardName5 and player2H2CardFileName5 then
                    player2dealtCardsFrameSplitH2.player2H2CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H2CardFileName5)
                    player2dealtCardsFrameSplitH2.player2H2CardImage5:Show()
                    player2dealtCardsFrameSplitH2.playerFifthCardText:Show()
                end
                if player2H2CardName6 and player2H2CardFileName6 then
                    player2dealtCardsFrameSplitH2.player2H2CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H2CardFileName6)
                    player2dealtCardsFrameSplitH2.player2H2CardImage6:Show()
                    player2dealtCardsFrameSplitH2.playerSixthCardText:Show()
                end
                if player2H2CardName7 and player2H2CardFileName7 then
                    player2dealtCardsFrameSplitH2.player2H2CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2H2CardFileName7)
                    player2dealtCardsFrameSplitH2.player2H2CardImage7:Show()
                    player2dealtCardsFrameSplitH2.playerSeventhCardText:Show()
                end
            
            elseif unitName3 and string.find(message, unitName3) then

                player3dealtCardsFrame.notStartedYetText:Hide()
                
                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    if turn == 1 then -- Player 3: 1st Card
                        player3MainCardName1 = dealtCards[1]
                        player3MainCardFileName1 = GetCardFileName(player3MainCardName1)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 3 then -- Player 3: 2nd Card
                        player3MainCardName2 = dealtCards[3]
                        player3MainCardFileName2 = GetCardFileName(player3MainCardName2)
                        player3H1CardName1 = dealtCards[1]
                        player3H1CardFileName1 = GetCardFileName(player3H1CardName1)
                        player3H2CardName1 = dealtCards[3]
                        player3H2CardFileName1 = GetCardFileName(player3H2CardName1)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 4 or turn == 23 then -- Player 3: 3rd Card or 3rd Card (Double)
                        player3MainCardName3 = dealtCards[4]
                        player3MainCardFileName3 = GetCardFileName(player3MainCardName3)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 5 then -- Player 3: 4th Card
                        player3MainCardName4 = dealtCards[5]
                        player3MainCardFileName4 = GetCardFileName(player3MainCardName4)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 6 then -- Player 3: 5th Card
                        player3MainCardName5 = dealtCards[6]
                        player3MainCardFileName5 = GetCardFileName(player3MainCardName5)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 7 then -- Player 3: 6th Card
                        player3MainCardName6 = dealtCards[7]
                        player3MainCardFileName6 = GetCardFileName(player3MainCardName6)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 8 then -- Player 3: 7th Card
                        player3MainCardName7 = dealtCards[8]
                        player3MainCardFileName7 = GetCardFileName(player3MainCardName7)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 9 then  -- Player 3: 2nd Card (Split H1)
                        player3H1CardName2 = dealtCards[4]
                        player3H1CardFileName2 = GetCardFileName(player3H1CardName2)
                        player3NumberOfCardsH1 = player3NumberOfCardsH1 + 2
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 10 then -- Player 3: 2nd Card (Split H2)
                        player3H2CardName2 = dealtCards[5]
                        player3H2CardFileName2 = GetCardFileName(player3H2CardName2)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 11 or turn == 16 then -- Player 3: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player3H1CardName3 = dealtCards[6]
                        player3H1CardFileName3 = GetCardFileName(player3H1CardName3)
                        player3NumberOfCardsH1 = player3NumberOfCardsH1 + 1
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 12 then -- Player 3: 4th Card (Split H1)
                        player3H1CardName4 = dealtCards[7]
                        player3H1CardFileName4 = GetCardFileName(player3H1CardName4)
                        player3NumberOfCardsH1 = player3NumberOfCardsH1 + 1
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 13 then -- Player 3: 5th Card (Split H1)
                        player3H1CardName5 = dealtCards[8]
                        player3H1CardFileName5 = GetCardFileName(player3H1CardName5)
                        player3NumberOfCardsH1 = player3NumberOfCardsH1 + 1
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 14 then -- Player 3: 6th Card (Split H1)
                        player3H1CardName6 = dealtCards[9]
                        player3H1CardFileName6 = GetCardFileName(player3H1CardName6)
                        player3NumberOfCardsH1 = player3NumberOfCardsH1 + 1
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 15 then -- Player 3: 7th Card (Split H1)
                        player3H1CardName7 = dealtCards[10]
                        player3H1CardFileName7 = GetCardFileName(player3H1CardName7)
                        player3NumberOfCardsH1 = player3NumberOfCardsH1 + 1
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 3: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player3H2CardName3 = dealtCards[player3NumberOfCardsH1 + 4]
                        player3H2CardFileName3 = GetCardFileName(player3H2CardName3)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 18 then -- Player 3: 4th Card (Split H2)
                        player3H2CardName4 = dealtCards[player3NumberOfCardsH1 + 5]
                        player3H2CardFileName4 = GetCardFileName(player3H2CardName4)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 19 then -- Player 3: 5th Card (Split H2)
                        player3H2CardName5 = dealtCards[player3NumberOfCardsH1 + 6]
                        player3H2CardFileName5 = GetCardFileName(player3H2CardName5)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 20 then -- Player 3: 6th Card (Split H2)
                        player3H2CardName6 = dealtCards[player3NumberOfCardsH1 + 7]
                        player3H2CardFileName6 = GetCardFileName(player3H2CardName6)
                        player3NumberOfCards = player3NumberOfCards + 1
                    elseif turn == 21 then -- Player 3: 7th Card (Split H2)
                        player3H2CardName7 = dealtCards[player3NumberOfCardsH1 + 8]
                        player3H2CardFileName7 = GetCardFileName(player3H2CardName7)
                        player3NumberOfCards = player3NumberOfCards + 1
                    end

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                 
                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
              
                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                
                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
              

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                 
                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
              
                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
               
                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
               
                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                
                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                 

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
             
                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                 
                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                   
                end

                -- >> MAIN HAND <<
                -- >> MAIN HAND <<

                if player3MainCardName1 and player3MainCardFileName1 then
                    player3dealtCardsFrame.player3MainCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3MainCardFileName1)
                    player3dealtCardsFrame.player3MainCardImage1:Show()
                    player3dealtCardsFrame.playerFirstCardText:Show()
                end
                if player3MainCardName2 and player3MainCardFileName2 then
                    player3dealtCardsFrame.player3MainCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3MainCardFileName2)
                    player3dealtCardsFrame.player3MainCardImage2:Show()
                    player3dealtCardsFrame.playerSecondCardText:Show()
                end
                if player3MainCardName3 and player3MainCardFileName3 then
                    player3dealtCardsFrame.player3MainCardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3MainCardFileName3)
                    player3dealtCardsFrame.player3MainCardImage3:Show()
                    player3dealtCardsFrame.playerThirdCardText:Show()
                end
                if player3MainCardName4 and player3MainCardFileName4 then
                    player3dealtCardsFrame.player3MainCardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3MainCardFileName4)
                    player3dealtCardsFrame.player3MainCardImage4:Show()
                    player3dealtCardsFrame.playerFourthCardText:Show()
                end
                if player3MainCardName5 and player3MainCardFileName5 then
                    player3dealtCardsFrame.player3MainCardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3MainCardFileName5)
                    player3dealtCardsFrame.player3MainCardImage5:Show()
                    player3dealtCardsFrame.playerFifthCardText:Show()
                end
                if player3MainCardName6 and player3MainCardFileName6 then
                    player3dealtCardsFrame.player3MainCardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3MainCardFileName6)
                    player3dealtCardsFrame.player3MainCardImage6:Show()
                    player3dealtCardsFrame.playerSixthCardText:Show()
                end
                if player3MainCardName7 and player3MainCardFileName7 then
                    player3dealtCardsFrame.player3MainCardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3MainCardFileName7)
                    player3dealtCardsFrame.player3MainCardImage7:Show()
                    player3dealtCardsFrame.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 1 <<
                -- >> SPLIT HAND 1 <<

                if player3H1CardName1 and player3H1CardFileName1 then
                    player3dealtCardsFrameSplitH1.player3H1CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H1CardFileName1)
                    player3dealtCardsFrameSplitH1.player3H1CardImage1:Show()
                    player3dealtCardsFrameSplitH1.playerFirstCardText:Show()
                end
                if player3H1CardName2 and player3H1CardFileName2 then
                    player3dealtCardsFrameSplitH1.player3H1CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H1CardFileName2)
                    player3dealtCardsFrameSplitH1.player3H1CardImage2:Show()
                    player3dealtCardsFrameSplitH1.playerSecondCardText:Show()
                end
                if player3H1CardName3 and player3H1CardFileName3 then
                    player3dealtCardsFrameSplitH1.player3H1CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H1CardFileName3)
                    player3dealtCardsFrameSplitH1.player3H1CardImage3:Show()
                    player3dealtCardsFrameSplitH1.playerThirdCardText:Show()
                end
                if player3H1CardName4 and player3H1CardFileName4 then
                    player3dealtCardsFrameSplitH1.player3H1CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H1CardFileName4)
                    player3dealtCardsFrameSplitH1.player3H1CardImage4:Show()
                    player3dealtCardsFrameSplitH1.playerFourthCardText:Show()
                end
                if player3H1CardName5 and player3H1CardFileName5 then
                    player3dealtCardsFrameSplitH1.player3H1CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H1CardFileName5)
                    player3dealtCardsFrameSplitH1.player3H1CardImage5:Show()
                    player3dealtCardsFrameSplitH1.playerFifthCardText:Show()
                end
                if player3H1CardName6 and player3H1CardFileName6 then
                    player3dealtCardsFrameSplitH1.player3H1CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H1CardFileName6)
                    player3dealtCardsFrameSplitH1.player3H1CardImage6:Show()
                    player3dealtCardsFrameSplitH1.playerSixthCardText:Show()
                end
                if player3H1CardName7 and player3H1CardFileName7 then
                    player3dealtCardsFrameSplitH1.player3H1CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H1CardFileName7)
                    player3dealtCardsFrameSplitH1.player3H1CardImage7:Show()
                    player3dealtCardsFrameSplitH1.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 2 <<
                -- >> SPLIT HAND 2 <<

                if player3H2CardName1 and player3H2CardFileName1 then
                    player3dealtCardsFrameSplitH2.player3H2CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H2CardFileName1)
                    player3dealtCardsFrameSplitH2.player3H2CardImage1:Show()
                    player3dealtCardsFrameSplitH2.playerFirstCardText:Show()
                end
                if player3H2CardName2 and player3H2CardFileName2 then
                    player3dealtCardsFrameSplitH2.player3H2CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H2CardFileName2)
                    player3dealtCardsFrameSplitH2.player3H2CardImage2:Show()
                    player3dealtCardsFrameSplitH2.playerSecondCardText:Show()
                end
                if player3H2CardName3 and player3H2CardFileName3 then
                    player3dealtCardsFrameSplitH2.player3H2CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H2CardFileName3)
                    player3dealtCardsFrameSplitH2.player3H2CardImage3:Show()
                    player3dealtCardsFrameSplitH2.playerThirdCardText:Show()
                end
                if player3H2CardName4 and player3H2CardFileName4 then
                    player3dealtCardsFrameSplitH2.player3H2CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H2CardFileName4)
                    player3dealtCardsFrameSplitH2.player3H2CardImage4:Show()
                    player3dealtCardsFrameSplitH2.playerFourthCardText:Show()
                end
                if player3H2CardName5 and player3H2CardFileName5 then
                    player3dealtCardsFrameSplitH2.player3H2CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H2CardFileName5)
                    player3dealtCardsFrameSplitH2.player3H2CardImage5:Show()
                    player3dealtCardsFrameSplitH2.playerFifthCardText:Show()
                end
                if player3H2CardName6 and player3H2CardFileName6 then
                    player3dealtCardsFrameSplitH2.player3H2CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H2CardFileName6)
                    player3dealtCardsFrameSplitH2.player3H2CardImage6:Show()
                    player3dealtCardsFrameSplitH2.playerSixthCardText:Show()
                end
                if player3H2CardName7 and player3H2CardFileName7 then
                    player3dealtCardsFrameSplitH2.player3H2CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3H2CardFileName7)
                    player3dealtCardsFrameSplitH2.player3H2CardImage7:Show()
                    player3dealtCardsFrameSplitH2.playerSeventhCardText:Show()
                end

            elseif unitName4 and string.find(message, unitName4) then

                player4dealtCardsFrame.notStartedYetText:Hide()
                
                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    if turn == 1 then -- Player 4: 1st Card
                        player4MainCardName1 = dealtCards[1]
                        player4MainCardFileName1 = GetCardFileName(player4MainCardName1)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 3 then -- Player 4: 2nd Card
                        player4MainCardName2 = dealtCards[3]
                        player4MainCardFileName2 = GetCardFileName(player4MainCardName2)
                        player4H1CardName1 = dealtCards[1]
                        player4H1CardFileName1 = GetCardFileName(player4H1CardName1)
                        player4H2CardName1 = dealtCards[3]
                        player4H2CardFileName1 = GetCardFileName(player4H2CardName1)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 4 or turn == 23 then -- Player 4: 3rd Card or 3rd Card (Double)
                        player4MainCardName3 = dealtCards[4]
                        player4MainCardFileName3 = GetCardFileName(player4MainCardName3)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 5 then -- Player 4: 4th Card
                        player4MainCardName4 = dealtCards[5]
                        player4MainCardFileName4 = GetCardFileName(player4MainCardName4)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 6 then -- Player 4: 5th Card
                        player4MainCardName5 = dealtCards[6]
                        player4MainCardFileName5 = GetCardFileName(player4MainCardName5)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 7 then -- Player 4: 6th Card
                        player4MainCardName6 = dealtCards[7]
                        player4MainCardFileName6 = GetCardFileName(player4MainCardName6)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 8 then -- Player 4: 7th Card
                        player4MainCardName7 = dealtCards[8]
                        player4MainCardFileName7 = GetCardFileName(player4MainCardName7)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 9 then  -- Player 4: 2nd Card (Split H1)
                        player4H1CardName2 = dealtCards[4]
                        player4H1CardFileName2 = GetCardFileName(player4H1CardName2)
                        player4NumberOfCardsH1 = player4NumberOfCardsH1 + 2
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 10 then -- Player 4: 2nd Card (Split H2)
                        player4H2CardName2 = dealtCards[5]
                        player4H2CardFileName2 = GetCardFileName(player4H2CardName2)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 11 or turn == 16 then -- Player 4: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player4H1CardName3 = dealtCards[6]
                        player4H1CardFileName3 = GetCardFileName(player4H1CardName3)
                        player4NumberOfCardsH1 = player4NumberOfCardsH1 + 1
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 12 then -- Player 4: 4th Card (Split H1)
                        player4H1CardName4 = dealtCards[7]
                        player4H1CardFileName4 = GetCardFileName(player4H1CardName4)
                        player4NumberOfCardsH1 = player4NumberOfCardsH1 + 1
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 13 then -- Player 4: 5th Card (Split H1)
                        player4H1CardName5 = dealtCards[8]
                        player4H1CardFileName5 = GetCardFileName(player4H1CardName5)
                        player4NumberOfCardsH1 = player4NumberOfCardsH1 + 1
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 14 then -- Player 4: 6th Card (Split H1)
                        player4H1CardName6 = dealtCards[9]
                        player4H1CardFileName6 = GetCardFileName(player4H1CardName6)
                        player4NumberOfCardsH1 = player4NumberOfCardsH1 + 1
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 15 then -- Player 4: 7th Card (Split H1)
                        player4H1CardName7 = dealtCards[10]
                        player4H1CardFileName7 = GetCardFileName(player4H1CardName7)
                        player4NumberOfCardsH1 = player4NumberOfCardsH1 + 1
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 4: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player4H2CardName3 = dealtCards[player4NumberOfCardsH1 + 4]
                        player4H2CardFileName3 = GetCardFileName(player4H2CardName3)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 18 then -- Player 4: 4th Card (Split H2)
                        player4H2CardName4 = dealtCards[player4NumberOfCardsH1 + 5]
                        player4H2CardFileName4 = GetCardFileName(player4H2CardName4)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 19 then -- Player 4: 5th Card (Split H2)
                        player4H2CardName5 = dealtCards[player4NumberOfCardsH1 + 6]
                        player4H2CardFileName5 = GetCardFileName(player4H2CardName5)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 20 then -- Player 4: 6th Card (Split H2)
                        player4H2CardName6 = dealtCards[player4NumberOfCardsH1 + 7]
                        player4H2CardFileName6 = GetCardFileName(player4H2CardName6)
                        player4NumberOfCards = player4NumberOfCards + 1
                    elseif turn == 21 then -- Player 4: 7th Card (Split H2)
                        player4H2CardName7 = dealtCards[player4NumberOfCardsH1 + 8]
                        player4H2CardFileName7 = GetCardFileName(player4H2CardName7)
                        player4NumberOfCards = player4NumberOfCards + 1
                    end
                
                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
            
                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
               
                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
            
                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
             

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
          
                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
          
                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
            
                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
            
                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
            
                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                 

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
            
                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
          
                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
        
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
       

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    

                end

                -- >> MAIN HAND <<
                -- >> MAIN HAND <<

                if player4MainCardName1 and player4MainCardFileName1 then
                    player4dealtCardsFrame.player4MainCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4MainCardFileName1)
                    player4dealtCardsFrame.player4MainCardImage1:Show()
                    player4dealtCardsFrame.playerFirstCardText:Show()
                end
                if player4MainCardName2 and player4MainCardFileName2 then
                    player4dealtCardsFrame.player4MainCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4MainCardFileName2)
                    player4dealtCardsFrame.player4MainCardImage2:Show()
                    player4dealtCardsFrame.playerSecondCardText:Show()
                end
                if player4MainCardName3 and player4MainCardFileName3 then
                    player4dealtCardsFrame.player4MainCardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4MainCardFileName3)
                    player4dealtCardsFrame.player4MainCardImage3:Show()
                    player4dealtCardsFrame.playerThirdCardText:Show()
                end
                if player4MainCardName4 and player4MainCardFileName4 then
                    player4dealtCardsFrame.player4MainCardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4MainCardFileName4)
                    player4dealtCardsFrame.player4MainCardImage4:Show()
                    player4dealtCardsFrame.playerFourthCardText:Show()
                end
                if player4MainCardName5 and player4MainCardFileName5 then
                    player4dealtCardsFrame.player4MainCardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4MainCardFileName5)
                    player4dealtCardsFrame.player4MainCardImage5:Show()
                    player4dealtCardsFrame.playerFifthCardText:Show()
                end
                if player4MainCardName6 and player4MainCardFileName6 then
                    player4dealtCardsFrame.player4MainCardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4MainCardFileName6)
                    player4dealtCardsFrame.player4MainCardImage6:Show()
                    player4dealtCardsFrame.playerSixthCardText:Show()
                end
                if player4MainCardName7 and player4MainCardFileName7 then
                    player4dealtCardsFrame.player4MainCardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4MainCardFileName7)
                    player4dealtCardsFrame.player4MainCardImage7:Show()
                    player4dealtCardsFrame.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 1 <<
                -- >> SPLIT HAND 1 <<

                if player4H1CardName1 and player4H1CardFileName1 then
                    player4dealtCardsFrameSplitH1.player4H1CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H1CardFileName1)
                    player4dealtCardsFrameSplitH1.player4H1CardImage1:Show()
                    player4dealtCardsFrameSplitH1.playerFirstCardText:Show()
                end
                if player4H1CardName2 and player4H1CardFileName2 then
                    player4dealtCardsFrameSplitH1.player4H1CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H1CardFileName2)
                    player4dealtCardsFrameSplitH1.player4H1CardImage2:Show()
                    player4dealtCardsFrameSplitH1.playerSecondCardText:Show()
                end
                if player4H1CardName3 and player4H1CardFileName3 then
                    player4dealtCardsFrameSplitH1.player4H1CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H1CardFileName3)
                    player4dealtCardsFrameSplitH1.player4H1CardImage3:Show()
                    player4dealtCardsFrameSplitH1.playerThirdCardText:Show()
                end
                if player4H1CardName4 and player4H1CardFileName4 then
                    player4dealtCardsFrameSplitH1.player4H1CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H1CardFileName4)
                    player4dealtCardsFrameSplitH1.player4H1CardImage4:Show()
                    player4dealtCardsFrameSplitH1.playerFourthCardText:Show()
                end
                if player4H1CardName5 and player4H1CardFileName5 then
                    player4dealtCardsFrameSplitH1.player4H1CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H1CardFileName5)
                    player4dealtCardsFrameSplitH1.player4H1CardImage5:Show()
                    player4dealtCardsFrameSplitH1.playerFifthCardText:Show()
                end
                if player4H1CardName6 and player4H1CardFileName6 then
                    player4dealtCardsFrameSplitH1.player4H1CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H1CardFileName6)
                    player4dealtCardsFrameSplitH1.player4H1CardImage6:Show()
                    player4dealtCardsFrameSplitH1.playerSixthCardText:Show()
                end
                if player4H1CardName7 and player4H1CardFileName7 then
                    player4dealtCardsFrameSplitH1.player4H1CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H1CardFileName7)
                    player4dealtCardsFrameSplitH1.player4H1CardImage7:Show()
                    player4dealtCardsFrameSplitH1.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 2 <<
                -- >> SPLIT HAND 2 <<

                if player4H2CardName1 and player4H2CardFileName1 then
                    player4dealtCardsFrameSplitH2.player4H2CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H2CardFileName1)
                    player4dealtCardsFrameSplitH2.player4H2CardImage1:Show()
                    player4dealtCardsFrameSplitH2.playerFirstCardText:Show()
                end
                if player4H2CardName2 and player4H2CardFileName2 then
                    player4dealtCardsFrameSplitH2.player4H2CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H2CardFileName2)
                    player4dealtCardsFrameSplitH2.player4H2CardImage2:Show()
                    player4dealtCardsFrameSplitH2.playerSecondCardText:Show()
                end
                if player4H2CardName3 and player4H2CardFileName3 then
                    player4dealtCardsFrameSplitH2.player4H2CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H2CardFileName3)
                    player4dealtCardsFrameSplitH2.player4H2CardImage3:Show()
                    player4dealtCardsFrameSplitH2.playerThirdCardText:Show()
                end
                if player4H2CardName4 and player4H2CardFileName4 then
                    player4dealtCardsFrameSplitH2.player4H2CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H2CardFileName4)
                    player4dealtCardsFrameSplitH2.player4H2CardImage4:Show()
                    player4dealtCardsFrameSplitH2.playerFourthCardText:Show()
                end
                if player4H2CardName5 and player4H2CardFileName5 then
                    player4dealtCardsFrameSplitH2.player4H2CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H2CardFileName5)
                    player4dealtCardsFrameSplitH2.player4H2CardImage5:Show()
                    player4dealtCardsFrameSplitH2.playerFifthCardText:Show()
                end
                if player4H2CardName6 and player4H2CardFileName6 then
                    player4dealtCardsFrameSplitH2.player4H2CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H2CardFileName6)
                    player4dealtCardsFrameSplitH2.player4H2CardImage6:Show()
                    player4dealtCardsFrameSplitH2.playerSixthCardText:Show()
                end
                if player4H2CardName7 and player4H2CardFileName7 then
                    player4dealtCardsFrameSplitH2.player4H2CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4H2CardFileName7)
                    player4dealtCardsFrameSplitH2.player4H2CardImage7:Show()
                    player4dealtCardsFrameSplitH2.playerSeventhCardText:Show()
                end

            elseif unitName5 and string.find(message, unitName5) then

                player5dealtCardsFrame.notStartedYetText:Hide()
                
                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    if turn == 1 then -- Player 5: 1st Card
                        player5MainCardName1 = dealtCards[1]
                        player5MainCardFileName1 = GetCardFileName(player5MainCardName1)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 3 then -- Player 5: 2nd Card
                        player5MainCardName2 = dealtCards[3]
                        player5MainCardFileName2 = GetCardFileName(player5MainCardName2)
                        player5H1CardName1 = dealtCards[1]
                        player5H1CardFileName1 = GetCardFileName(player5H1CardName1)
                        player5H2CardName1 = dealtCards[3]
                        player5H2CardFileName1 = GetCardFileName(player5H2CardName1)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 4 or turn == 23 then -- Player 5: 3rd Card or 3rd Card (Double)
                        player5MainCardName3 = dealtCards[4]
                        player5MainCardFileName3 = GetCardFileName(player5MainCardName3)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 5 then -- Player 5: 4th Card
                        player5MainCardName4 = dealtCards[5]
                        player5MainCardFileName4 = GetCardFileName(player5MainCardName4)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 6 then -- Player 5: 5th Card
                        player5MainCardName5 = dealtCards[6]
                        player5MainCardFileName5 = GetCardFileName(player5MainCardName5)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 7 then -- Player 5: 6th Card
                        player5MainCardName6 = dealtCards[7]
                        player5MainCardFileName6 = GetCardFileName(player5MainCardName6)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 8 then -- Player 5: 7th Card
                        player5MainCardName7 = dealtCards[8]
                        player5MainCardFileName7 = GetCardFileName(player5MainCardName7)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 9 then  -- Player 5: 2nd Card (Split H1)
                        player5H1CardName2 = dealtCards[4]
                        player5H1CardFileName2 = GetCardFileName(player5H1CardName2)
                        player5NumberOfCardsH1 = player5NumberOfCardsH1 + 2
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 10 then -- Player 5: 2nd Card (Split H2)
                        player5H2CardName2 = dealtCards[5]
                        player5H2CardFileName2 = GetCardFileName(player5H2CardName2)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 11 or turn == 16 then -- Player 5: 3rd Card (Split H1) or 3rd Card (Double) (Split H1)
                        player5H1CardName3 = dealtCards[6]
                        player5H1CardFileName3 = GetCardFileName(player5H1CardName3)
                        player5NumberOfCardsH1 = player5NumberOfCardsH1 + 1
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 12 then -- Player 5: 4th Card (Split H1)
                        player5H1CardName4 = dealtCards[7]
                        player5H1CardFileName4 = GetCardFileName(player5H1CardName4)
                        player5NumberOfCardsH1 = player5NumberOfCardsH1 + 1
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 13 then -- Player 5: 5th Card (Split H1)
                        player5H1CardName5 = dealtCards[8]
                        player5H1CardFileName5 = GetCardFileName(player5H1CardName5)
                        player5NumberOfCardsH1 = player5NumberOfCardsH1 + 1
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 14 then -- Player 5: 6th Card (Split H1)
                        player5H1CardName6 = dealtCards[9]
                        player5H1CardFileName6 = GetCardFileName(player5H1CardName6)
                        player5NumberOfCardsH1 = player5NumberOfCardsH1 + 1
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 15 then -- Player 5: 7th Card (Split H1)
                        player5H1CardName7 = dealtCards[10]
                        player5H1CardFileName7 = GetCardFileName(player5H1CardName7)
                        player5NumberOfCardsH1 = player5NumberOfCardsH1 + 1
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 17 or turn == 22 then -- Player 5: 3rd Card (Split H2) or 3rd Card (Double) (Split H2)
                        player5H2CardName3 = dealtCards[player5NumberOfCardsH1 + 4]
                        player5H2CardFileName3 = GetCardFileName(player5H2CardName3)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 18 then -- Player 5: 4th Card (Split H2)
                        player5H2CardName4 = dealtCards[player5NumberOfCardsH1 + 5]
                        player5H2CardFileName4 = GetCardFileName(player5H2CardName4)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 19 then -- Player 5: 5th Card (Split H2)
                        player5H2CardName5 = dealtCards[player5NumberOfCardsH1 + 6]
                        player5H2CardFileName5 = GetCardFileName(player5H2CardName5)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 20 then -- Player 5: 6th Card (Split H2)
                        player5H2CardName6 = dealtCards[player5NumberOfCardsH1 + 7]
                        player5H2CardFileName6 = GetCardFileName(player5H2CardName6)
                        player5NumberOfCards = player5NumberOfCards + 1
                    elseif turn == 21 then -- Player 5: 7th Card (Split H2)
                        player5H2CardName7 = dealtCards[player5NumberOfCardsH1 + 8]
                        player5H2CardFileName7 = GetCardFileName(player5H2CardName7)
                        player5NumberOfCards = player5NumberOfCards + 1
                    end
                
                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                
                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
             
                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
               
                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                  

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
          
                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
              
                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                
                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
             
                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                   
                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                  

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                
                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
              
                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
             
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
              

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
        
                end

                -- >> MAIN HAND <<
                -- >> MAIN HAND <<

                if player5MainCardName1 and player5MainCardFileName1 then
                    player5dealtCardsFrame.player5MainCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5MainCardFileName1)
                    player5dealtCardsFrame.player5MainCardImage1:Show()
                    player5dealtCardsFrame.playerFirstCardText:Show()
                end
                if player5MainCardName2 and player5MainCardFileName2 then
                    player5dealtCardsFrame.player5MainCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5MainCardFileName2)
                    player5dealtCardsFrame.player5MainCardImage2:Show()
                    player5dealtCardsFrame.playerSecondCardText:Show()
                end
                if player5MainCardName3 and player5MainCardFileName3 then
                    player5dealtCardsFrame.player5MainCardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5MainCardFileName3)
                    player5dealtCardsFrame.player5MainCardImage3:Show()
                    player5dealtCardsFrame.playerThirdCardText:Show()
                end
                if player5MainCardName4 and player5MainCardFileName4 then
                    player5dealtCardsFrame.player5MainCardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5MainCardFileName4)
                    player5dealtCardsFrame.player5MainCardImage4:Show()
                    player5dealtCardsFrame.playerFourthCardText:Show()
                end
                if player5MainCardName5 and player5MainCardFileName5 then
                    player5dealtCardsFrame.player5MainCardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5MainCardFileName5)
                    player5dealtCardsFrame.player5MainCardImage5:Show()
                    player5dealtCardsFrame.playerFifthCardText:Show()
                end
                if player5MainCardName6 and player5MainCardFileName6 then
                    player5dealtCardsFrame.player5MainCardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5MainCardFileName6)
                    player5dealtCardsFrame.player5MainCardImage6:Show()
                    player5dealtCardsFrame.playerSixthCardText:Show()
                end
                if player5MainCardName7 and player5MainCardFileName7 then
                    player5dealtCardsFrame.player5MainCardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5MainCardFileName7)
                    player5dealtCardsFrame.player5MainCardImage7:Show()
                    player5dealtCardsFrame.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 1 <<
                -- >> SPLIT HAND 1 <<

                if player5H1CardName1 and player5H1CardFileName1 then
                    player5dealtCardsFrameSplitH1.player5H1CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H1CardFileName1)
                    player5dealtCardsFrameSplitH1.player5H1CardImage1:Show()
                    player5dealtCardsFrameSplitH1.playerFirstCardText:Show()
                end
                if player5H1CardName2 and player5H1CardFileName2 then
                    player5dealtCardsFrameSplitH1.player5H1CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H1CardFileName2)
                    player5dealtCardsFrameSplitH1.player5H1CardImage2:Show()
                    player5dealtCardsFrameSplitH1.playerSecondCardText:Show()
                end
                if player5H1CardName3 and player5H1CardFileName3 then
                    player5dealtCardsFrameSplitH1.player5H1CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H1CardFileName3)
                    player5dealtCardsFrameSplitH1.player5H1CardImage3:Show()
                    player5dealtCardsFrameSplitH1.playerThirdCardText:Show()
                end
                if player5H1CardName4 and player5H1CardFileName4 then
                    player5dealtCardsFrameSplitH1.player5H1CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H1CardFileName4)
                    player5dealtCardsFrameSplitH1.player5H1CardImage4:Show()
                    player5dealtCardsFrameSplitH1.playerFourthCardText:Show()
                end
                if player5H1CardName5 and player5H1CardFileName5 then
                    player5dealtCardsFrameSplitH1.player5H1CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H1CardFileName5)
                    player5dealtCardsFrameSplitH1.player5H1CardImage5:Show()
                    player5dealtCardsFrameSplitH1.playerFifthCardText:Show()
                end
                if player5H1CardName6 and player5H1CardFileName6 then
                    player5dealtCardsFrameSplitH1.player5H1CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H1CardFileName6)
                    player5dealtCardsFrameSplitH1.player5H1CardImage6:Show()
                    player5dealtCardsFrameSplitH1.playerSixthCardText:Show()
                end
                if player5H1CardName7 and player5H1CardFileName7 then
                    player5dealtCardsFrameSplitH1.player5H1CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H1CardFileName7)
                    player5dealtCardsFrameSplitH1.player5H1CardImage7:Show()
                    player5dealtCardsFrameSplitH1.playerSeventhCardText:Show()
                end

                -- >> SPLIT HAND 2 <<
                -- >> SPLIT HAND 2 <<

                if player5H2CardName1 and player5H2CardFileName1 then
                    player5dealtCardsFrameSplitH2.player5H2CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H2CardFileName1)
                    player5dealtCardsFrameSplitH2.player5H2CardImage1:Show()
                    player5dealtCardsFrameSplitH2.playerFirstCardText:Show()
                end
                if player5H2CardName2 and player5H2CardFileName2 then
                    player5dealtCardsFrameSplitH2.player5H2CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H2CardFileName2)
                    player5dealtCardsFrameSplitH2.player5H2CardImage2:Show()
                    player5dealtCardsFrameSplitH2.playerSecondCardText:Show()
                end
                if player5H2CardName3 and player5H2CardFileName3 then
                    player5dealtCardsFrameSplitH2.player5H2CardImage3:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H2CardFileName3)
                    player5dealtCardsFrameSplitH2.player5H2CardImage3:Show()
                    player5dealtCardsFrameSplitH2.playerThirdCardText:Show()
                end
                if player5H2CardName4 and player5H2CardFileName4 then
                    player5dealtCardsFrameSplitH2.player5H2CardImage4:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H2CardFileName4)
                    player5dealtCardsFrameSplitH2.player5H2CardImage4:Show()
                    player5dealtCardsFrameSplitH2.playerFourthCardText:Show()
                end
                if player5H2CardName5 and player5H2CardFileName5 then
                    player5dealtCardsFrameSplitH2.player5H2CardImage5:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H2CardFileName5)
                    player5dealtCardsFrameSplitH2.player5H2CardImage5:Show()
                    player5dealtCardsFrameSplitH2.playerFifthCardText:Show()
                end
                if player5H2CardName6 and player5H2CardFileName6 then
                    player5dealtCardsFrameSplitH2.player5H2CardImage6:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H2CardFileName6)
                    player5dealtCardsFrameSplitH2.player5H2CardImage6:Show()
                    player5dealtCardsFrameSplitH2.playerSixthCardText:Show()
                end
                if player5H2CardName7 and player5H2CardFileName7 then
                    player5dealtCardsFrameSplitH2.player5H2CardImage7:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5H2CardFileName7)
                    player5dealtCardsFrameSplitH2.player5H2CardImage7:Show()
                    player5dealtCardsFrameSplitH2.playerSeventhCardText:Show()
                end

            end

        elseif string.find(message, "turned") then
            PlaySoundFile(soundFilePaths[32])
            playerFrame.player1TurnArrow:Hide()
            playerFrame.player2TurnArrow:Hide()
            playerFrame.player3TurnArrow:Hide()
            playerFrame.player4TurnArrow:Hide()
            playerFrame.player5TurnArrow:Hide()

        elseif string.find(message, "What is your decision") then
            if string.find(message, "(H1)") then
                if unitName1 and string.find(message, unitName1) then
                    playerFrame.player1TurnArrow:Show()
                    if playerName == unitName1 then
                        player1SplitHand1Turn()
                        player1SplitH1StartCountdown()
                    end
                elseif unitName2 and string.find(message, unitName2) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Show()
                    if playerName == unitName2 then
                        player2SplitHand1Turn()
                        player2SplitH1StartCountdown()
                    end
                elseif unitName3 and string.find(message, unitName3) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Show()
                    if playerName == unitName3 then
                        player3SplitHand1Turn()
                        player3SplitH1StartCountdown()
                    end
                elseif unitName4 and string.find(message, unitName4) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Hide()
                    playerFrame.player4TurnArrow:Show()
                    if playerName == unitName4 then
                        player4SplitHand1Turn()
                        player4SplitH1StartCountdown()
                    end
                elseif unitName5 and string.find(message, unitName5) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Hide()
                    playerFrame.player4TurnArrow:Hide()
                    playerFrame.player5TurnArrow:Show()
                    if playerName == unitName5 then
                        player5SplitHand1Turn()
                        player5SplitH1StartCountdown()
                    end
                end
            elseif string.find(message, "(H2)") then
                if unitName1 and string.find(message, unitName1) then
                    playerFrame.player1TurnArrow:Show()
                    if playerName == unitName1 then
                        player1SplitHand2Turn()
                        player1SplitH2StartCountdown()
                    end
                elseif unitName2 and string.find(message, unitName2) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Show()
                    if playerName == unitName2 then
                        player2SplitHand2Turn()
                        player2SplitH2StartCountdown()
                    end
                elseif unitName3 and string.find(message, unitName3) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Show()
                    if playerName == unitName3 then
                        player3SplitHand2Turn()
                        player3SplitH2StartCountdown()
                    end
                elseif unitName4 and string.find(message, unitName4) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Hide()
                    playerFrame.player4TurnArrow:Show()
                    if playerName == unitName4 then
                        player4SplitHand2Turn()
                        player4SplitH2StartCountdown()
                    end
                elseif unitName5 and string.find(message, unitName5) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Hide()
                    playerFrame.player4TurnArrow:Hide()
                    playerFrame.player5TurnArrow:Show()
                    if playerName == unitName5 then
                        player5SplitHand2Turn()
                        player5SplitH2StartCountdown()
                    end
                end
            end
            if not string.find(message, "(H1)") and not string.find(message, "(H2)") then
                if unitName1 and string.find(message, unitName1) then
                    playerFrame.player1TurnArrow:Show()
                    if playerName == unitName1 then
                        player1Turn()
                        player1StartCountdown()
                    end
                elseif unitName2 and string.find(message, unitName2) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Show()
                    if playerName == unitName2 then
                        player2Turn()
                        player2StartCountdown()
                    end
                elseif unitName3 and string.find(message, unitName3) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Show()
                    if playerName == unitName3 then
                        player3Turn()
                        player3StartCountdown()
                    end
                elseif unitName4 and string.find(message, unitName4) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Hide()
                    playerFrame.player4TurnArrow:Show()
                    if playerName == unitName4 then
                        player4Turn()
                        player4StartCountdown()
                    end
                elseif unitName5 and string.find(message, unitName5) then
                    playerFrame.player1TurnArrow:Hide()
                    playerFrame.player2TurnArrow:Hide()
                    playerFrame.player3TurnArrow:Hide()
                    playerFrame.player4TurnArrow:Hide()
                    playerFrame.player5TurnArrow:Show()
                    if playerName == unitName5 then
                        player5Turn()
                        player5StartCountdown()
                    end
                end
            end
        

            




        -- >>> BLACKJACK <<<
        -- >>> BLACKJACK <<<
        -- >>> BLACKJACK <<<

        -- Dealer
        elseif string.find(message, "Dealer got Blackjack") then
            PlaySoundFile(soundFilePaths[111]) -- "Dealer - Blackjack"
            playerFrame.dealerCardTotalText:SetText("Blackjack")
            playerFrame.dealerCardTotalText:SetTextColor(1, 1, 0)

        -- Single Hand
        elseif string.find(message, "has Blackjack") and not string.find(message, "Hand 1") and not string.find(message, "Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[38]) -- "Player 1 - Blackjack"
                playerFrame.player1CardTotalText:SetText("Blackjack")
                playerFrame.player1CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[52]) -- "Player 2 - Blackjack"
                playerFrame.player2CardTotalText:SetText("Blackjack")
                playerFrame.player2CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[66]) -- "Player 3 - Blackjack"
                playerFrame.player3CardTotalText:SetText("Blackjack")
                playerFrame.player3CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[80]) -- "Player 4 - Blackjack"
                playerFrame.player4CardTotalText:SetText("Blackjack")
                playerFrame.player4CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[94]) -- "Player 5 - Blackjack"
                playerFrame.player5CardTotalText:SetText("Blackjack")
                playerFrame.player5CardTotalText:SetTextColor(1, 1, 0)
            end

        -- Split Hand 1
        elseif string.find(message, "Hand 1") and string.find(message, "has Blackjack") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[38]) -- "Player 1 - Blackjack"
                playerFrame.player1SplitHand1CardTotalText:SetText("Blackjack")
                playerFrame.player1SplitHand1CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[52]) -- "Player 2 - Blackjack"
                playerFrame.player2SplitHand1CardTotalText:SetText("Blackjack")
                playerFrame.player2SplitHand1CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[66]) -- "Player 3 - Blackjack"
                playerFrame.player3SplitHand1CardTotalText:SetText("Blackjack")
                playerFrame.player3SplitHand1CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[80]) -- "Player 4 - Blackjack"
                playerFrame.player4SplitHand1CardTotalText:SetText("Blackjack")
                playerFrame.player4SplitHand1CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[94]) -- "Player 5 - Blackjack"
                playerFrame.player5SplitHand1CardTotalText:SetText("Blackjack")
                playerFrame.player5SplitHand1CardTotalText:SetTextColor(1, 1, 0)
            end

        -- Split Hand 2
        elseif string.find(message, "Hand 2") and string.find(message, "has Blackjack") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[38]) -- "Player 1 - Blackjack"
                playerFrame.player1SplitHand2CardTotalText:SetText("Blackjack")
                playerFrame.player1SplitHand2CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[52]) -- "Player 2 - Blackjack"
                playerFrame.player2SplitHand2CardTotalText:SetText("Blackjack")
                playerFrame.player2SplitHand2CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[66]) -- "Player 3 - Blackjack"
                playerFrame.player3SplitHand2CardTotalText:SetText("Blackjack")
                playerFrame.player3SplitHand2CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[80]) -- "Player 4 - Blackjack"
                playerFrame.player4SplitHand2CardTotalText:SetText("Blackjack")
                playerFrame.player4SplitHand2CardTotalText:SetTextColor(1, 1, 0)
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[94]) -- "Player 5 - Blackjack"
                playerFrame.player5SplitHand2CardTotalText:SetText("Blackjack")
                playerFrame.player5SplitHand2CardTotalText:SetTextColor(1, 1, 0)
            end 













        -- >>> RESULTS <<<
        -- >>> RESULTS <<<
        -- >>> RESULTS <<<

        -- Bust (Single Hand)
        elseif string.find(message, "has gone bust with a total of") and not string.find(message, "Hand 1") and not string.find(message, "Hand 2") then
            
            player1BeforeStandValue = playerFrame.player1CardTotalText:GetText()
            player2BeforeStandValue = playerFrame.player2CardTotalText:GetText()
            player3BeforeStandValue = playerFrame.player3CardTotalText:GetText()
            player4BeforeStandValue = playerFrame.player4CardTotalText:GetText()
            player5BeforeStandValue = playerFrame.player5CardTotalText:GetText()
            
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[42]) -- "Player 1 - Bust"
                player1MainBetAmount:SetTextColor(1, 0, 0)
                
                player1Hotstreak = 0
                player1HotStreakCheck()

                player1SessionWinAnnouncement()

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    turn = 23
                    player1Loss()
                    player1InsuranceLoss()

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end
                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end
                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end
                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end
                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end
                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end
                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end
                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end
                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 49
                    else
                        turn = 29
                    end
                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 49
                    else
                        turn = 29
                    end
                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 49
                    else
                        turn = 29
                    end
                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 49
                    else
                        turn = 29
                    end

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if player2BeforeStandValue == "Blackjack" then
                        turn = 51
                    else
                        turn = 31
                    end
                end

            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[56]) -- "Player 2 - Bust"
                player2MainBetAmount:SetTextColor(1, 0, 0)
                
                player2Hotstreak = 0
                player2HotStreakCheck()

                player2SessionWinAnnouncement()

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    turn = 23
                    player2Loss()
                    player2InsuranceLoss()

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    turn = 45
                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end
                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end
                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end
                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end
                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 69
                    else
                        turn = 49
                    end
                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 69
                    else
                        turn = 49
                    end
                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 69
                    else
                        turn = 49
                    end
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 49
                    else
                        turn = 29
                    end

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if player3BeforeStandValue == "Blackjack" then
                        turn = 71
                    else
                        turn = 51
                    end
                end

            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[70]) -- "Player 3 - Bust"
                player3MainBetAmount:SetTextColor(1, 0, 0)
                
                player3Hotstreak = 0
                player3HotStreakCheck()

                player3SessionWinAnnouncement()

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    turn = 23
                    player3Loss()
                    player3InsuranceLoss()

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    turn = 45
                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    turn = 45
                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end
                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    turn = 67
                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 47
                    else
                        turn = 27
                    end

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 69
                    else
                        turn = 49
                    end
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 69
                    else
                        turn = 49
                    end

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if player4BeforeStandValue == "Blackjack" then
                        turn = 91
                    else
                        turn = 71
                    end

                end

            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[84]) -- "Player 4 - Bust"
                player4MainBetAmount:SetTextColor(1, 0, 0)
                
                player4Hotstreak = 0
                player4HotStreakCheck()

                player4SessionWinAnnouncement()

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    turn = 23
                    player4Loss()
                    player4InsuranceLoss()

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    turn = 45
                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    turn = 45
                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    turn = 45
                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 45
                    else
                        turn = 25
                    end

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    turn = 67
                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    turn = 67
                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    turn = 67
                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end
                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 67
                    else
                        turn = 47
                    end

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    turn = 89
                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 89
                    else
                        turn = 69
                    end

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    if player5BeforeStandValue == "Blackjack" then
                        turn = 111
                    else
                        turn = 91
                    end
                end

            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[98]) -- "Player 5 - Bust"
                player5MainBetAmount:SetTextColor(1, 0, 0)

                player5Hotstreak = 0
                player5HotStreakCheck()

                player5SessionWinAnnouncement()

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    turn = 23
                    player5Loss()
                    player5InsuranceLoss()

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    turn = 45
                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    turn = 45
                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    turn = 45
                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    turn = 45

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    turn = 67
                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    turn = 67
                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    turn = 67
                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    turn = 67
                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    turn = 67
                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    turn = 67

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    turn = 89
                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    turn = 89
                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    turn = 89
                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    turn = 89

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    turn = 111
                end
            end

        -- Bust (Split Hand 1)
        elseif string.find(message, "has gone bust with a total of") and string.find(message, "Hand 1") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[42]) -- "Player 1 - Bust"
                player1SplitH1BetAmount:SetTextColor(1, 0, 0)
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[56]) -- "Player 2 - Bust"
                player2SplitH1BetAmount:SetTextColor(1, 0, 0)
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[70]) -- "Player 3 - Bust"
                player3SplitH1BetAmount:SetTextColor(1, 0, 0)
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[84]) -- "Player 4 - Bust"
                player4SplitH1BetAmount:SetTextColor(1, 0, 0)
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[98]) -- "Player 5 - Bust"
                player5SplitH1BetAmount:SetTextColor(1, 0, 0)
            end

        -- Bust (Split Hand 2)
        elseif string.find(message, "has gone bust with a total of") and string.find(message, "Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[42]) -- "Player 1 - Bust"
                player1SplitH2BetAmount:SetTextColor(1, 0, 0)
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[56]) -- "Player 2 - Bust"
                player2SplitH2BetAmount:SetTextColor(1, 0, 0)
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[70]) -- "Player 3 - Bust"
                player3SplitH2BetAmount:SetTextColor(1, 0, 0)
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[84]) -- "Player 4 - Bust"
                player4SplitH2BetAmount:SetTextColor(1, 0, 0)
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[98]) -- "Player 5 - Bust"
                player5SplitH2BetAmount:SetTextColor(1, 0, 0)
            end


        -- Win (Single Hand)
        elseif string.find(message, "has won this round") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[39]) -- "Player 1 - Win"
                player1MainBetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player1CardTotalText:GetText() == "Blackjack" then
                    player1BJWin()
                else
                    player1Win()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = player1Hotstreak + 1
                player1HotStreakCheck()

            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[53]) -- "Player 2 - Win"
                player2MainBetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player2CardTotalText:GetText() == "Blackjack" then
                    player2BJWin()
                else
                    player2Win()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = player2Hotstreak + 1
                player2HotStreakCheck()

            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[67]) -- "Player 3 - Win"
                player3MainBetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player3CardTotalText:GetText() == "Blackjack" then
                    player3BJWin()
                else
                    player3Win()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = player3Hotstreak + 1
                player3HotStreakCheck()

            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[81]) -- "Player 4 - Win"
                player4MainBetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player4CardTotalText:GetText() == "Blackjack" then
                    player4BJWin()
                else
                    player4Win()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = player4Hotstreak + 1
                player4HotStreakCheck()

            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[95]) -- "Player 5 - Win"
                player5MainBetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player5CardTotalText:GetText() == "Blackjack" then
                    player5BJWin()
                else
                    player5Win()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = player5Hotstreak + 1
                player5HotStreakCheck()

            end

        -- Push (Single Hand)
        elseif string.find(message, "has pushed this round") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[40]) -- "Player 1 - Push"
                player1MainBetAmount:SetTextColor(0.2, 0.7, 1)
                player1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[54]) -- "Player 2 - Push"
                player2MainBetAmount:SetTextColor(0.2, 0.7, 1)
                player2Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[68]) -- "Player 3 - Push"
                player3MainBetAmount:SetTextColor(0.2, 0.7, 1)
                player3Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[82]) -- "Player 4 - Push"
                player4MainBetAmount:SetTextColor(0.2, 0.7, 1)
                player4Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[96]) -- "Player 5 - Push"
                player5MainBetAmount:SetTextColor(0.2, 0.7, 1)
                player5Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

            end
            

        -- Loss (Single Hand)
        elseif string.find(message, "has lost this round") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[41]) -- "Player 1 - Loss"
                player1MainBetAmount:SetTextColor(1, 0, 0)
                player1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = 0
                player1HotStreakCheck()

            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[55]) -- "Player 2 - Loss"
                player2MainBetAmount:SetTextColor(1, 0, 0)
                player2Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = 0
                player2HotStreakCheck()

            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[69]) -- "Player 3 - Loss"
                player3MainBetAmount:SetTextColor(1, 0, 0)
                player3Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = 0
                player3HotStreakCheck()

            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[83]) -- "Player 4 - Loss"
                player4MainBetAmount:SetTextColor(1, 0, 0)
                player4Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = 0
                player4HotStreakCheck()

            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[97]) -- "Player 5 - Loss"
                player5MainBetAmount:SetTextColor(1, 0, 0)
                player5Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = 0
                player5HotStreakCheck()

            end
            

        -- Win/Win (Split Hand)
        elseif string.find(message, "has won both Hand 1 and Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[43]) -- "Player 1 - H1 Win, H2 Win"
                player1SplitH1BetAmount:SetTextColor(0, 1, 0)
                player1SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player1SplitH2BJ()
                else
                    player1SplitH2Win()
                end

                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player1SplitH1BJ()
                else
                    player1SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = player1Hotstreak + 2
                player1HotStreakCheck()
                
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[57]) -- "Player 2 - H1 Win, H2 Win"
                player2SplitH1BetAmount:SetTextColor(0, 1, 0)
                player2SplitH2BetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player2SplitH2BJ()
                else
                    player2SplitH2Win()
                end

                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player2SplitH1BJ()
                else
                    player2SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = player2Hotstreak + 2
                player2HotStreakCheck()
                
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[71]) -- "Player 3 - H1 Win, H2 Win"
                player3SplitH1BetAmount:SetTextColor(0, 1, 0)
                player3SplitH2BetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player3SplitH2BJ()
                else
                    player3SplitH2Win()
                end

                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player3SplitH1BJ()
                else
                    player3SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = player3Hotstreak + 2
                player3HotStreakCheck()
                
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[85]) -- "Player 4 - H1 Win, H2 Win"
                player4SplitH1BetAmount:SetTextColor(0, 1, 0)
                player4SplitH2BetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player4SplitH2BJ()
                else
                    player4SplitH2Win()
                end

                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player4SplitH1BJ()
                else
                    player4SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = player4Hotstreak + 2
                player4HotStreakCheck()
                
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[99]) -- "Player 5 - H1 Win, H2 Win"
                player5SplitH1BetAmount:SetTextColor(0, 1, 0)
                player5SplitH2BetAmount:SetTextColor(0, 1, 0)

                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player5SplitH2BJ()
                else
                    player5SplitH2Win()
                end

                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player5SplitH1BJ()
                else
                    player5SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = player5Hotstreak + 2
                player5HotStreakCheck()
                
            end

        -- Win/Push (Split Hand)
        elseif string.find(message, "has won Hand 1 and pushes on Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[44]) -- "Player 1 - H1 Win, H2 Push"
                player1SplitH1BetAmount:SetTextColor(0, 1, 0)
                player1SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player1SplitH2Push()
                
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player1SplitH1BJ()
                else
                    player1SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = player1Hotstreak + 1
                player1HotStreakCheck()

            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[58]) -- "Player 2 - H1 Win, H2 Push"
                player2SplitH1BetAmount:SetTextColor(0, 1, 0)
                player2SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player2SplitH2Push()

                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player2SplitH1BJ()
                else
                    player2SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = player2Hotstreak + 1
                player2HotStreakCheck()

            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[72]) -- "Player 3 - H1 Win, H2 Push"
                player3SplitH1BetAmount:SetTextColor(0, 1, 0)
                player3SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player3SplitH2Push()

                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player3SplitH1BJ()
                else
                    player3SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = player3Hotstreak + 1
                player3HotStreakCheck()

            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[86]) -- "Player 4 - H1 Win, H2 Push"
                player4SplitH1BetAmount:SetTextColor(0, 1, 0)
                player4SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player4SplitH2Push()

                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player4SplitH1BJ()
                else
                    player4SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = player4Hotstreak + 1
                player4HotStreakCheck()

            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[100]) -- "Player 5 - H1 Win, H2 Push"
                player5SplitH1BetAmount:SetTextColor(0, 1, 0)
                player5SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player5SplitH2Push()

                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player5SplitH1BJ()
                else
                    player5SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = player5Hotstreak + 1
                player5HotStreakCheck()

            end

        -- Win/Loss (Split Hand)
        elseif string.find(message, "has won Hand 1 and lost Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[45]) -- "Player 1 - H1 Win, H2 Loss"
                player1SplitH1BetAmount:SetTextColor(0, 1, 0)
                player1SplitH2BetAmount:SetTextColor(1, 0, 0)
                player1SplitH2Loss()
                
                if playerFrame.player1SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player1SplitH1BJ()
                else
                    player1SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = 0
                player1HotStreakCheck()
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[59]) -- "Player 2 - H1 Win, H2 Loss"
                player2SplitH1BetAmount:SetTextColor(0, 1, 0)
                player2SplitH2BetAmount:SetTextColor(1, 0, 0)
                player2SplitH2Loss()

                if playerFrame.player2SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player2SplitH1BJ()
                else
                    player2SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = 0
                player2HotStreakCheck()
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[73]) -- "Player 3 - H1 Win, H2 Loss"
                player3SplitH1BetAmount:SetTextColor(0, 1, 0)
                player3SplitH2BetAmount:SetTextColor(1, 0, 0)
                player3SplitH2Loss()

                if playerFrame.player3SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player3SplitH1BJ()
                else
                    player3SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = 0
                player3HotStreakCheck()
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[87]) -- "Player 4 - H1 Win, H2 Loss"
                player4SplitH1BetAmount:SetTextColor(0, 1, 0)
                player4SplitH2BetAmount:SetTextColor(1, 0, 0)
                player4SplitH2Loss()

                if playerFrame.player4SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player4SplitH1BJ()
                else
                    player4SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = 0
                player4HotStreakCheck()
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[101]) -- "Player 5 - H1 Win, H2 Loss"
                player5SplitH1BetAmount:SetTextColor(0, 1, 0)
                player5SplitH2BetAmount:SetTextColor(1, 0, 0)
                player5SplitH2Loss()

                if playerFrame.player5SplitHand1CardTotalText:GetText() == "Blackjack" then
                    player5SplitH1BJ()
                else
                    player5SplitH1Win()
                end

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = 0
                player5HotStreakCheck()
            end

        -- Push/Push (Split Hand)
        elseif string.find(message, "pushes on both Hand 1 and Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[47]) -- "Player 1 - H1 Push, H2 Push"
                player1SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player1SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player1SplitH2Push()
                player1SplitH1Push()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[61]) -- "Player 2 - H1 Push, H2 Push"
                player2SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player2SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player2SplitH2Push()
                player2SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[75]) -- "Player 3 - H1 Push, H2 Push"
                player3SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player3SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player3SplitH2Push()
                player3SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[89]) -- "Player 4 - H1 Push, H2 Push"
                player4SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player4SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player4SplitH2Push()
                player4SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[103]) -- "Player 5 - H1 Push, H2 Push"
                player5SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player5SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player5SplitH2Push()
                player5SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

            end

        -- Push/Win (Split Hand)
        elseif string.find(message, "pushes on Hand 1 and has won Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[46]) -- "Player 1 - H1 Push, H2 Win"
                player1SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player1SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player1SplitH2BJ()
                else
                    player1SplitH2Win()
                end

                player1SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = player1Hotstreak + 1
                player1HotStreakCheck()
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[60]) -- "Player 2 - H1 Push, H2 Win"
                player2SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player2SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player2SplitH2BJ()
                else
                    player2SplitH2Win()
                end

                player2SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = player2Hotstreak + 1
                player2HotStreakCheck()
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[74]) -- "Player 3 - H1 Push, H2 Win"
                player3SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player3SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player3SplitH2BJ()
                else
                    player3SplitH2Win()
                end

                player3SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = player3Hotstreak + 1
                player3HotStreakCheck()
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[88]) -- "Player 4 - H1 Push, H2 Win"
                player4SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player4SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player4SplitH2BJ()
                else
                    player4SplitH2Win()
                end

                player4SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = player4Hotstreak + 1
                player4HotStreakCheck()
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[102]) -- "Player 5 - H1 Push, H2 Win"
                player5SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player5SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player5SplitH2BJ()
                else
                    player5SplitH2Win()
                end

                player5SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = player5Hotstreak + 1
                player5HotStreakCheck()
            end

        -- Push/Loss (Split Hand)
        elseif string.find(message, "pushes on Hand 1 and has lost Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[48]) -- "Player 1 - H1 Push, H2 Loss"
                player1SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player1SplitH2BetAmount:SetTextColor(1, 0, 0)
                player1SplitH2Loss()
                player1SplitH1Push()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = 0
                player1HotStreakCheck()
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[62]) -- "Player 2 - H1 Push, H2 Loss"
                player2SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player2SplitH2BetAmount:SetTextColor(1, 0, 0)
                player2SplitH2Loss()
                player2SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = 0
                player2HotStreakCheck()
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[76]) -- "Player 3 - H1 Push, H2 Loss"
                player3SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player3SplitH2BetAmount:SetTextColor(1, 0, 0)
                player3SplitH2Loss()
                player3SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = 0
                player3HotStreakCheck()
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[90]) -- "Player 4 - H1 Push, H2 Loss"
                player4SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player4SplitH2BetAmount:SetTextColor(1, 0, 0)
                player4SplitH2Loss()
                player4SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = 0
                player4HotStreakCheck()
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[104]) -- "Player 5 - H1 Push, H2 Loss"
                player5SplitH1BetAmount:SetTextColor(0.2, 0.7, 1)
                player5SplitH2BetAmount:SetTextColor(1, 0, 0)
                player5SplitH2Loss()
                player5SplitH1Push()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = 0
                player5HotStreakCheck()
            end
        
        -- Loss/Loss (Split Hand)
        elseif string.find(message, "has lost both Hand 1 and Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[51]) -- "Player 1 - H1 Loss, H2 Loss"
                player1SplitH1BetAmount:SetTextColor(1, 0, 0)
                player1SplitH2BetAmount:SetTextColor(1, 0, 0)
                player1SplitH2Loss()
                player1SplitH1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = 0
                player1HotStreakCheck()
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[65]) -- "Player 2 - H1 Loss, H2 Loss"
                player2SplitH1BetAmount:SetTextColor(1, 0, 0)
                player2SplitH2BetAmount:SetTextColor(1, 0, 0)
                player2SplitH2Loss()
                player2SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = 0
                player2HotStreakCheck()
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[79]) -- "Player 3 - H1 Loss, H2 Loss"
                player3SplitH1BetAmount:SetTextColor(1, 0, 0)
                player3SplitH2BetAmount:SetTextColor(1, 0, 0)
                player3SplitH2Loss()
                player3SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = 0
                player3HotStreakCheck()
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[93]) -- "Player 4 - H1 Loss, H2 Loss"
                player4SplitH1BetAmount:SetTextColor(1, 0, 0)
                player4SplitH2BetAmount:SetTextColor(1, 0, 0)
                player4SplitH2Loss()
                player4SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = 0
                player4HotStreakCheck()
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[107]) -- "Player 5 - H1 Loss, H2 Loss"
                player5SplitH1BetAmount:SetTextColor(1, 0, 0)
                player5SplitH2BetAmount:SetTextColor(1, 0, 0)
                player5SplitH2Loss()
                player5SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = 0
                player5HotStreakCheck()
            end

        -- Loss/Push (Split Hand)
        elseif string.find(message, "has lost Hand 1 and pushes on Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[50]) -- "Player 1 - H1 Loss, H2 Push"
                player1SplitH1BetAmount:SetTextColor(1, 0, 0)
                player1SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player1SplitH2Push()
                player1SplitH1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = 0
                player1HotStreakCheck()
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[64]) -- "Player 2 - H1 Loss, H2 Push"
                player2SplitH1BetAmount:SetTextColor(1, 0, 0)
                player2SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player2SplitH2Push()
                player2SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = 0
                player2HotStreakCheck()
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[78]) -- "Player 3 - H1 Loss, H2 Push"
                player3SplitH1BetAmount:SetTextColor(1, 0, 0)
                player3SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player3SplitH2Push()
                player3SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = 0
                player3HotStreakCheck()
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[92]) -- "Player 4 - H1 Loss, H2 Push"
                player4SplitH1BetAmount:SetTextColor(1, 0, 0)
                player4SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player4SplitH2Push()
                player4SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = 0
                player4HotStreakCheck()
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[106]) -- "Player 5 - H1 Loss, H2 Push"
                player5SplitH1BetAmount:SetTextColor(1, 0, 0)
                player5SplitH2BetAmount:SetTextColor(0.2, 0.7, 1)
                player5SplitH2Push()
                player5SplitH1Loss()

                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = 0
                player5HotStreakCheck()
            end

        -- Loss/Win (Split Hand)
        elseif string.find(message, "has lost Hand 1 and won Hand 2") then
            if unitName1 and string.find(message, unitName1) then
                PlaySoundFile(soundFilePaths[49]) -- "Player 1 - H1 Loss, H2 Win"
                player1SplitH1BetAmount:SetTextColor(1, 0, 0)
                player1SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player1SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player1SplitH2BJ()
                else
                    player1SplitH2Win()
                end

                player1SplitH1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player1InsuranceWin()
                else
                    player1InsuranceLoss()
                end

                player1SessionWinAnnouncement()

                player1Hotstreak = 0
                player1HotStreakCheck()
            elseif unitName2 and string.find(message, unitName2) then
                PlaySoundFile(soundFilePaths[63]) -- "Player 2 - H1 Loss, H2 Win"
                player2SplitH1BetAmount:SetTextColor(1, 0, 0)
                player2SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player2SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player2SplitH2BJ()
                else
                    player2SplitH2Win()
                end

                player2SplitH1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player2InsuranceWin()
                else
                    player2InsuranceLoss()
                end

                player2SessionWinAnnouncement()

                player2Hotstreak = 0
                player2HotStreakCheck()
            elseif unitName3 and string.find(message, unitName3) then
                PlaySoundFile(soundFilePaths[77]) -- "Player 3 - H1 Loss, H2 Win"
                player3SplitH1BetAmount:SetTextColor(1, 0, 0)
                player3SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player3SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player3SplitH2BJ()
                else
                    player3SplitH2Win()
                end

                player3SplitH1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player3InsuranceWin()
                else
                    player3InsuranceLoss()
                end

                player3SessionWinAnnouncement()

                player3Hotstreak = 0
                player3HotStreakCheck()
            elseif unitName4 and string.find(message, unitName4) then
                PlaySoundFile(soundFilePaths[91]) -- "Player 4 - H1 Loss, H2 Win"
                player4SplitH1BetAmount:SetTextColor(1, 0, 0)
                player4SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player4SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player4SplitH2BJ()
                else
                    player4SplitH2Win()
                end

                player4SplitH1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player4InsuranceWin()
                else
                    player4InsuranceLoss()
                end

                player4SessionWinAnnouncement()

                player4Hotstreak = 0
                player4HotStreakCheck()
            elseif unitName5 and string.find(message, unitName5) then
                PlaySoundFile(soundFilePaths[105]) -- "Player 5 - H1 Loss, H2 Win"
                player5SplitH1BetAmount:SetTextColor(1, 0, 0)
                player5SplitH2BetAmount:SetTextColor(0, 1, 0)
                
                if playerFrame.player5SplitHand2CardTotalText:GetText() == "Blackjack" then
                    player5SplitH2BJ()
                else
                    player5SplitH2Win()
                end

                player5SplitH1Loss()
                
                if playerFrame.dealerCardTotalText:GetText() == "Blackjack" then
                    player5InsuranceWin()
                else
                    player5InsuranceLoss()
                end

                player5SessionWinAnnouncement()

                player5Hotstreak = 0
                player5HotStreakCheck()
            end
















        -- >>> SIDE BETS <<<
        -- >>> SIDE BETS <<<
        -- >>> SIDE BETS <<<

        














        elseif string.find(message, "hit a Suited Three of a Kind") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player1213CardName2 = dealtCards[3]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[6]
                    player1213CardName2 = dealtCards[7]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                end

                if player1213CardFileName1 then
                    sideBetWinFrame213.player1213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName1)
                else
                    print("Card image filename not found for " .. player1213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player1213CardFileName2 then
                    sideBetWinFrame213.player1213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName2)
                else
                    print("Card image filename not found for " .. player1213CardName2)
                end

                if playerName == unitName1 then
                    player1SuitedThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player1SuitedThreeOfAKindWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player2213CardName2 = dealtCards[3]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[6]
                    player2213CardName2 = dealtCards[8]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                end

                if player2213CardFileName1 then
                    sideBetWinFrame213.player2213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName1)
                else
                    print("Card image filename not found for " .. player2213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player2213CardFileName2 then
                    sideBetWinFrame213.player2213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName2)
                else
                    print("Card image filename not found for " .. player2213CardName2)
                end

                if playerName == unitName2 then
                    player2SuitedThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player2SuitedThreeOfAKindWin()
                else
                    print("")
                end  
            
            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player3213CardName2 = dealtCards[3]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[6]
                    player3213CardName2 = dealtCards[9]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                end

                if player3213CardFileName1 then
                    sideBetWinFrame213.player3213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName1)
                else
                    print("Card image filename not found for " .. player3213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player3213CardFileName2 then
                    sideBetWinFrame213.player3213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName2)
                else
                    print("Card image filename not found for " .. player3213CardName2)
                end

                if playerName == unitName3 then
                    player3SuitedThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player3SuitedThreeOfAKindWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player4213CardName2 = dealtCards[3]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[4]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[9]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[6]
                    player4213CardName2 = dealtCards[10]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                end

                if player4213CardFileName1 then
                    sideBetWinFrame213.player4213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName1)
                else
                    print("Card image filename not found for " .. player4213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player4213CardFileName2 then
                    sideBetWinFrame213.player4213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName2)
                else
                    print("Card image filename not found for " .. player4213CardName2)
                end

                if playerName == unitName4 then
                    player4SuitedThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player4SuitedThreeOfAKindWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player5213CardName2 = dealtCards[3]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5213CardName2 = dealtCards[11]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)
                end

                if player5213CardFileName1 then
                    sideBetWinFrame213.player5213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName1)
                else
                    print("Card image filename not found for " .. player5213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player5213CardFileName2 then
                    sideBetWinFrame213.player5213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName2)
                else
                    print("Card image filename not found for " .. player5213CardName2)
                end

                if playerName == unitName5 then
                    player5SuitedThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player5SuitedThreeOfAKindWin()
                else
                    print("")
                end  

            end
        elseif string.find(message, "hit a Straight Flush") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player1213CardName2 = dealtCards[3]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[6]
                    player1213CardName2 = dealtCards[7]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                end

                if player1213CardFileName1 then
                    sideBetWinFrame213.player1213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName1)
                else
                    print("Card image filename not found for " .. player1213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player1213CardFileName2 then
                    sideBetWinFrame213.player1213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName2)
                else
                    print("Card image filename not found for " .. player1213CardName2)
                end

                if playerName == unitName1 then
                    player1StraightFlushNotification()
                end

                if string.find(message, "congratulations") then
                    player1StraightFlushWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player2213CardName2 = dealtCards[3]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[6]
                    player2213CardName2 = dealtCards[8]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                end

                if player2213CardFileName1 then
                    sideBetWinFrame213.player2213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName1)
                else
                    print("Card image filename not found for " .. player2213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player2213CardFileName2 then
                    sideBetWinFrame213.player2213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName2)
                else
                    print("Card image filename not found for " .. player2213CardName2)
                end

                if playerName == unitName2 then
                    player2StraightFlushNotification()
                end

                if string.find(message, "congratulations") then
                    player2StraightFlushWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player3213CardName2 = dealtCards[3]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[6]
                    player3213CardName2 = dealtCards[9]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                end

                if player3213CardFileName1 then
                    sideBetWinFrame213.player3213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName1)
                else
                    print("Card image filename not found for " .. player3213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player3213CardFileName2 then
                    sideBetWinFrame213.player3213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName2)
                else
                    print("Card image filename not found for " .. player3213CardName2)
                end

                if playerName == unitName3 then
                    player3StraightFlushNotification()
                end

                if string.find(message, "congratulations") then
                    player3StraightFlushWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player4213CardName2 = dealtCards[3]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[4]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[9]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[6]
                    player4213CardName2 = dealtCards[10]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                end

                if player4213CardFileName1 then
                    sideBetWinFrame213.player4213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName1)
                else
                    print("Card image filename not found for " .. player4213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player4213CardFileName2 then
                    sideBetWinFrame213.player4213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName2)
                else
                    print("Card image filename not found for " .. player4213CardName2)
                end

                if playerName == unitName4 then
                    player4StraightFlushNotification()
                end

                if string.find(message, "congratulations") then
                    player4StraightFlushWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player5213CardName2 = dealtCards[3]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5213CardName2 = dealtCards[11]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)
                end

                if player5213CardFileName1 then
                    sideBetWinFrame213.player5213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName1)
                else
                    print("Card image filename not found for " .. player5213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player5213CardFileName2 then
                    sideBetWinFrame213.player5213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName2)
                else
                    print("Card image filename not found for " .. player5213CardName2)
                end

                if playerName == unitName5 then
                    player5StraightFlushNotification()
                end

                if string.find(message, "congratulations") then
                    player5StraightFlushWin()
                else
                    print("")
                end 

            end
        elseif string.find(message, "hit a Flush") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player1213CardName2 = dealtCards[3]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[6]
                    player1213CardName2 = dealtCards[7]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                end

                if player1213CardFileName1 then
                    sideBetWinFrame213.player1213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName1)
                else
                    print("Card image filename not found for " .. player1213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player1213CardFileName2 then
                    sideBetWinFrame213.player1213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName2)
                else
                    print("Card image filename not found for " .. player1213CardName2)
                end

                if playerName == unitName1 then
                    player1FlushNotification()
                end

                if string.find(message, "congratulations") then
                    player1FlushWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player2213CardName2 = dealtCards[3]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[6]
                    player2213CardName2 = dealtCards[8]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                end

                if player2213CardFileName1 then
                    sideBetWinFrame213.player2213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName1)
                else
                    print("Card image filename not found for " .. player2213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player2213CardFileName2 then
                    sideBetWinFrame213.player2213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName2)
                else
                    print("Card image filename not found for " .. player2213CardName2)
                end

                if playerName == unitName2 then
                    player2FlushNotification()
                end

                if string.find(message, "congratulations") then
                    player2FlushWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player3213CardName2 = dealtCards[3]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[6]
                    player3213CardName2 = dealtCards[9]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                end

                if player3213CardFileName1 then
                    sideBetWinFrame213.player3213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName1)
                else
                    print("Card image filename not found for " .. player3213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player3213CardFileName2 then
                    sideBetWinFrame213.player3213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName2)
                else
                    print("Card image filename not found for " .. player3213CardName2)
                end

                if playerName == unitName3 then
                    player3FlushNotification()
                end

                if string.find(message, "congratulations") then
                    player3FlushWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player4213CardName2 = dealtCards[3]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[4]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[9]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[6]
                    player4213CardName2 = dealtCards[10]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                end

                if player4213CardFileName1 then
                    sideBetWinFrame213.player4213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName1)
                else
                    print("Card image filename not found for " .. player4213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player4213CardFileName2 then
                    sideBetWinFrame213.player4213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName2)
                else
                    print("Card image filename not found for " .. player4213CardName2)
                end

                if playerName == unitName4 then
                    player4FlushNotification()
                end

                if string.find(message, "congratulations") then
                    player4FlushWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player5213CardName2 = dealtCards[3]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5213CardName2 = dealtCards[11]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)
                end

                if player5213CardFileName1 then
                    sideBetWinFrame213.player5213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName1)
                else
                    print("Card image filename not found for " .. player5213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player5213CardFileName2 then
                    sideBetWinFrame213.player5213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName2)
                else
                    print("Card image filename not found for " .. player5213CardName2)
                end

                if playerName == unitName5 then
                    player5FlushNotification()
                end

                if string.find(message, "congratulations") then
                    player5FlushWin()
                else
                    print("")
                end 
            end
        elseif string.find(message, "hit a Three of a Kind") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player1213CardName2 = dealtCards[3]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[6]
                    player1213CardName2 = dealtCards[7]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                end

                if player1213CardFileName1 then
                    sideBetWinFrame213.player1213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName1)
                else
                    print("Card image filename not found for " .. player1213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player1213CardFileName2 then
                    sideBetWinFrame213.player1213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName2)
                else
                    print("Card image filename not found for " .. player1213CardName2)
                end

                if playerName == unitName1 then
                    player1ThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player1ThreeOfAKindWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player2213CardName2 = dealtCards[3]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[6]
                    player2213CardName2 = dealtCards[8]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                end

                if player2213CardFileName1 then
                    sideBetWinFrame213.player2213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName1)
                else
                    print("Card image filename not found for " .. player2213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player2213CardFileName2 then
                    sideBetWinFrame213.player2213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName2)
                else
                    print("Card image filename not found for " .. player2213CardName2)
                end

                if playerName == unitName2 then
                    player2ThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player2ThreeOfAKindWin()
                else
                    print("")
                end  
            
            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player3213CardName2 = dealtCards[3]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[6]
                    player3213CardName2 = dealtCards[9]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                end

                if player3213CardFileName1 then
                    sideBetWinFrame213.player3213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName1)
                else
                    print("Card image filename not found for " .. player3213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player3213CardFileName2 then
                    sideBetWinFrame213.player3213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName2)
                else
                    print("Card image filename not found for " .. player3213CardName2)
                end

                if playerName == unitName3 then
                    player3ThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player3ThreeOfAKindWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player4213CardName2 = dealtCards[3]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[4]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[9]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[6]
                    player4213CardName2 = dealtCards[10]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                end

                if player4213CardFileName1 then
                    sideBetWinFrame213.player4213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName1)
                else
                    print("Card image filename not found for " .. player4213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player4213CardFileName2 then
                    sideBetWinFrame213.player4213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName2)
                else
                    print("Card image filename not found for " .. player4213CardName2)
                end

                if playerName == unitName4 then
                    player4ThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player4ThreeOfAKindWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player5213CardName2 = dealtCards[3]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5213CardName2 = dealtCards[11]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)
                end

                if player5213CardFileName1 then
                    sideBetWinFrame213.player5213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName1)
                else
                    print("Card image filename not found for " .. player5213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player5213CardFileName2 then
                    sideBetWinFrame213.player5213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName2)
                else
                    print("Card image filename not found for " .. player5213CardName2)
                end

                if playerName == unitName5 then
                    player5ThreeOfAKindNotification()
                end

                if string.find(message, "congratulations") then
                    player5ThreeOfAKindWin()
                else
                    print("")
                end

            end
        elseif string.find(message, "hit a Straight") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player1213CardName2 = dealtCards[3]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player1213CardName2 = dealtCards[4]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player1213CardName2 = dealtCards[5]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player1213CardName2 = dealtCards[6]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[6]
                    player1213CardName2 = dealtCards[7]

                    player1213CardFileName1 = GetCardFileName(player1213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player1213CardFileName2 = GetCardFileName(player1213CardName2)

                end

                if player1213CardFileName1 then
                    sideBetWinFrame213.player1213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName1)
                else
                    print("Card image filename not found for " .. player1213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player1213CardFileName2 then
                    sideBetWinFrame213.player1213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1213CardFileName2)
                else
                    print("Card image filename not found for " .. player1213CardName2)
                end

                if playerName == unitName1 then
                    player1StraightNotification()
                end

                if string.find(message, "congratulations") then
                    player1StraightWin()
                else
                    print("")
                end
            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player2213CardName2 = dealtCards[3]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player2213CardName2 = dealtCards[4]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player2213CardName2 = dealtCards[5]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[7]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[5]
                    player2213CardName2 = dealtCards[6]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[6]
                    player2213CardName2 = dealtCards[8]

                    player2213CardFileName1 = GetCardFileName(player2213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player2213CardFileName2 = GetCardFileName(player2213CardName2)

                end

                if player2213CardFileName1 then
                    sideBetWinFrame213.player2213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName1)
                else
                    print("Card image filename not found for " .. player2213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player2213CardFileName2 then
                    sideBetWinFrame213.player2213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2213CardFileName2)
                else
                    print("Card image filename not found for " .. player2213CardName2)
                end

                if playerName == unitName2 then
                    player2StraightNotification()
                end

                if string.find(message, "congratulations") then
                    player2StraightWin()
                else
                    print("")
                end  
            
            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player3213CardName2 = dealtCards[3]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player3213CardName2 = dealtCards[4]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[6]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[4]
                    player3213CardName2 = dealtCards[5]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[8]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[5]
                    player3213CardName2 = dealtCards[7]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[6]
                    player3213CardName2 = dealtCards[9]

                    player3213CardFileName1 = GetCardFileName(player3213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player3213CardFileName2 = GetCardFileName(player3213CardName2)

                end

                if player3213CardFileName1 then
                    sideBetWinFrame213.player3213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName1)
                else
                    print("Card image filename not found for " .. player3213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player3213CardFileName2 then
                    sideBetWinFrame213.player3213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3213CardFileName2)
                else
                    print("Card image filename not found for " .. player3213CardName2)
                end

                if playerName == unitName3 then
                    player3StraightNotification()
                end

                if string.find(message, "congratulations") then
                    player3StraightWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player4213CardName2 = dealtCards[3]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[5]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[3]
                    player4213CardName2 = dealtCards[4]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[7]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[4]
                    player4213CardName2 = dealtCards[6]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[9]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[5]
                    player4213CardName2 = dealtCards[8]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[6]
                    player4213CardName2 = dealtCards[10]

                    player4213CardFileName1 = GetCardFileName(player4213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player4213CardFileName2 = GetCardFileName(player4213CardName2)

                end

                if player4213CardFileName1 then
                    sideBetWinFrame213.player4213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName1)
                else
                    print("Card image filename not found for " .. player4213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player4213CardFileName2 then
                    sideBetWinFrame213.player4213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4213CardFileName2)
                else
                    print("Card image filename not found for " .. player4213CardName2)
                end

                if playerName == unitName4 then
                    player4StraightNotification()
                end

                if string.find(message, "congratulations") then
                    player4StraightWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[1]
                    dealer213CardName1 = dealtCards[2]
                    player5213CardName2 = dealtCards[3]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5213CardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5213CardName2 = dealtCards[5]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5213CardName2 = dealtCards[7]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5213CardName2 = dealtCards[9]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5213CardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5213CardName2 = dealtCards[11]

                    player5213CardFileName1 = GetCardFileName(player5213CardName1)
                    dealer213CardFileName1 = GetCardFileName(dealer213CardName1)
                    player5213CardFileName2 = GetCardFileName(player5213CardName2)
                end

                if player5213CardFileName1 then
                    sideBetWinFrame213.player5213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName1)
                else
                    print("Card image filename not found for " .. player5213CardName1)
                end
                if dealer213CardFileName1 then
                    sideBetWinFrame213.dealer213CardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. dealer213CardFileName1)
                else
                    print("Card image filename not found for " .. dealer213CardName1)
                end
                if player5213CardFileName2 then
                    sideBetWinFrame213.player5213CardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5213CardFileName2)
                else
                    print("Card image filename not found for " .. player5213CardName2)
                end

                if playerName == unitName5 then
                    player5StraightNotification()
                end

                if string.find(message, "congratulations") then
                    player5StraightWin()
                else
                    print("")
                end

            end
        elseif string.find(message, "hit a Perfect Pair") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[3]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[7]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                end

                if player1PPCardFileName1 then
                    sideBetWinFramePP.player1PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1PPCardFileName1)
                else
                    print("Card image filename not found for " .. player1PPCardName1)
                end
                if player1PPCardFileName2 then
                    sideBetWinFramePP.player1PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1PPCardFileName2)
                else
                    print("Card image filename not found for " .. player1PPCardName2)
                end

                if playerName == unitName1 then
                    player1PerfectPairNotification()
                end

                if string.find(message, "congratulations") then
                    player1PerfectPairWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[3]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[8]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                end

                if player2PPCardFileName1 then
                    sideBetWinFramePP.player2PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2PPCardFileName1)
                else
                    print("Card image filename not found for " .. player2PPCardName1)
                end
                if player2PPCardFileName2 then
                    sideBetWinFramePP.player2PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2PPCardFileName2)
                else
                    print("Card image filename not found for " .. player2PPCardName2)
                end

                if playerName == unitName2 then
                    player2PerfectPairNotification()
                end

                if string.find(message, "congratulations") then
                    player2PerfectPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[3]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[4]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[4]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[8]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[8]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[9]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                end

                if player3PPCardFileName1 then
                    sideBetWinFramePP.player3PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3PPCardFileName1)
                else
                    print("Card image filename not found for " .. player3PPCardName1)
                end
                if player3PPCardFileName2 then
                    sideBetWinFramePP.player3PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3PPCardFileName2)
                else
                    print("Card image filename not found for " .. player3PPCardName2)
                end

                if playerName == unitName3 then
                    player3PerfectPairNotification()
                end

                if string.find(message, "congratulations") then
                    player3PerfectPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[1]
                    player4PPCardName2 = dealtCards[3]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4PPCardName1 = dealtCards[1]
                    player4PPCardName2 = dealtCards[4]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[4]
                    player4PPCardName2 = dealtCards[9]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[4]
                    player4PPCardName2 = dealtCards[10]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                end

                if player4PPCardFileName1 then
                    sideBetWinFramePP.player4PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4PPCardFileName1)
                else
                    print("Card image filename not found for " .. player4PPCardName1)
                end
                if player4PPCardFileName2 then
                    sideBetWinFramePP.player4PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4PPCardFileName2)
                else
                    print("Card image filename not found for " .. player4PPCardName2)
                end

                if playerName == unitName4 then
                    player4PerfectPairNotification()
                end

                if string.find(message, "congratulations") then
                    player4PerfectPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[1]
                    player5PPCardName2 = dealtCards[3]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5PPCardName2 = dealtCards[11]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)
                end

                if player5PPCardFileName1 then
                    sideBetWinFramePP.player5PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5PPCardFileName1)
                else
                    print("Card image filename not found for " .. player5PPCardName1)
                end
                if player5PPCardFileName2 then
                    sideBetWinFramePP.player5PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5PPCardFileName2)
                else
                    print("Card image filename not found for " .. player5PPCardName2)
                end

                if playerName == unitName5 then
                    player5PerfectPairNotification()
                end

                if string.find(message, "congratulations") then
                    player5PerfectPairWin()
                else
                    print("")
                end

            end
        elseif string.find(message, "hit a Coloured Pair") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[3]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[7]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                end

                if player1PPCardFileName1 then
                    sideBetWinFramePP.player1PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1PPCardFileName1)
                else
                    print("Card image filename not found for " .. player1PPCardName1)
                end
                if player1PPCardFileName2 then
                    sideBetWinFramePP.player1PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1PPCardFileName2)
                else
                    print("Card image filename not found for " .. player1PPCardName2)
                end

                if playerName == unitName1 then
                    player1ColouredPairNotification()
                end

                if string.find(message, "congratulations") then
                    player1ColouredPairWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[3]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[8]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                end

                if player2PPCardFileName1 then
                    sideBetWinFramePP.player2PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2PPCardFileName1)
                else
                    print("Card image filename not found for " .. player2PPCardName1)
                end
                if player2PPCardFileName2 then
                    sideBetWinFramePP.player2PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2PPCardFileName2)
                else
                    print("Card image filename not found for " .. player2PPCardName2)
                end

                if playerName == unitName2 then
                    player2ColouredPairNotification()
                end

                if string.find(message, "congratulations") then
                    player2ColouredPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[3]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[4]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[4]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[8]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[8]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[9]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                end

                if player3PPCardFileName1 then
                    sideBetWinFramePP.player3PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3PPCardFileName1)
                else
                    print("Card image filename not found for " .. player3PPCardName1)
                end
                if player3PPCardFileName2 then
                    sideBetWinFramePP.player3PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3PPCardFileName2)
                else
                    print("Card image filename not found for " .. player3PPCardName2)
                end

                if playerName == unitName3 then
                    player3ColouredPairNotification()
                end

                if string.find(message, "congratulations") then
                    player3ColouredPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[1]
                    player4PPCardName2 = dealtCards[3]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4PPCardName1 = dealtCards[1]
                    player4PPCardName2 = dealtCards[4]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[4]
                    player4PPCardName2 = dealtCards[9]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[4]
                    player4PPCardName2 = dealtCards[10]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                end

                if player4PPCardFileName1 then
                    sideBetWinFramePP.player4PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4PPCardFileName1)
                else
                    print("Card image filename not found for " .. player4PPCardName1)
                end
                if player4PPCardFileName2 then
                    sideBetWinFramePP.player4PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4PPCardFileName2)
                else
                    print("Card image filename not found for " .. player4PPCardName2)
                end

                if playerName == unitName4 then
                    player4ColouredPairNotification()
                end

                if string.find(message, "congratulations") then
                    player4ColouredPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[1]
                    player5PPCardName2 = dealtCards[3]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5PPCardName2 = dealtCards[11]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)
                end

                if player5PPCardFileName1 then
                    sideBetWinFramePP.player5PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5PPCardFileName1)
                else
                    print("Card image filename not found for " .. player5PPCardName1)
                end
                if player5PPCardFileName2 then
                    sideBetWinFramePP.player5PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5PPCardFileName2)
                else
                    print("Card image filename not found for " .. player5PPCardName2)
                end

                if playerName == unitName5 then
                    player5ColouredPairNotification()
                end

                if string.find(message, "congratulations") then
                    player5ColouredPairWin()
                else
                    print("")
                end
                
            end
        elseif string.find(message, "hit a Mixed Pair") then
            if string.find(message, "Player 1") then 

                -- Players: 1
                if player1Active and not player2Active and not player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[3]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[4]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)


                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[5]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[6]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player1PPCardName1 = dealtCards[1]
                    player1PPCardName2 = dealtCards[7]

                    player1PPCardFileName1 = GetCardFileName(player1PPCardName1)
                    player1PPCardFileName2 = GetCardFileName(player1PPCardName2)

                end

                if player1PPCardFileName1 then
                    sideBetWinFramePP.player1PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1PPCardFileName1)
                else
                    print("Card image filename not found for " .. player1PPCardName1)
                end
                if player1PPCardFileName2 then
                    sideBetWinFramePP.player1PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player1PPCardFileName2)
                else
                    print("Card image filename not found for " .. player1PPCardName2)
                end

                if playerName == unitName1 then
                    player1MixedPairNotification()
                end

                if string.find(message, "congratulations") then
                    player1MixedPairWin()
                else
                    print("")
                end

            elseif string.find(message, "Player 2") then

                -- Players: 2
                if not player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[3]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2
                elseif player1Active and player2Active and not player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[4]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)
                    
                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[5]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[7]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[1]
                    player2PPCardName2 = dealtCards[6]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player2PPCardName1 = dealtCards[2]
                    player2PPCardName2 = dealtCards[8]

                    player2PPCardFileName1 = GetCardFileName(player2PPCardName1)
                    player2PPCardFileName2 = GetCardFileName(player2PPCardName2)

                end

                if player2PPCardFileName1 then
                    sideBetWinFramePP.player2PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2PPCardFileName1)
                else
                    print("Card image filename not found for " .. player2PPCardName1)
                end
                if player2PPCardFileName2 then
                    sideBetWinFramePP.player2PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player2PPCardFileName2)
                else
                    print("Card image filename not found for " .. player2PPCardName2)
                end

                if playerName == unitName2 then
                    player2MixedPairNotification()
                end

                if string.find(message, "congratulations") then
                    player2MixedPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 3") then

                -- Players: 3
                if not player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[3]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3
                elseif player1Active and not player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3
                elseif not player1Active and player2Active and player3Active and not player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[4]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[4]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3
                elseif player1Active and player2Active and player3Active and not player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[6]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[1]
                    player3PPCardName2 = dealtCards[5]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[8]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[8]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[2]
                    player3PPCardName2 = dealtCards[7]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player3PPCardName1 = dealtCards[3]
                    player3PPCardName2 = dealtCards[9]

                    player3PPCardFileName1 = GetCardFileName(player3PPCardName1)
                    player3PPCardFileName2 = GetCardFileName(player3PPCardName2)

                end

                if player3PPCardFileName1 then
                    sideBetWinFramePP.player3PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3PPCardFileName1)
                else
                    print("Card image filename not found for " .. player3PPCardName1)
                end
                if player3PPCardFileName2 then
                    sideBetWinFramePP.player3PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player3PPCardFileName2)
                else
                    print("Card image filename not found for " .. player3PPCardName2)
                end

                if playerName == unitName3 then
                    player3MixedPairNotification()
                end

                if string.find(message, "congratulations") then
                    player3MixedPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 4") then

                -- Players: 4
                if not player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[1]
                    player4PPCardName2 = dealtCards[3]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 4
                elseif player1Active and not player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 4
                elseif not player1Active and player2Active and not player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 3, 4
                elseif not player1Active and not player2Active and player3Active and player4Active and not player5Active then
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[5]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player4PPCardName1 = dealtCards[1]
                    player4PPCardName2 = dealtCards[4]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 4
                elseif player1Active and player2Active and not player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 3, 4
                elseif player1Active and not player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 3, 4
                elseif not player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[7]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[2]
                    player4PPCardName2 = dealtCards[6]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 3, 4
                elseif player1Active and player2Active and player3Active and player4Active and not player5Active then    
                    player4PPCardName1 = dealtCards[4]
                    player4PPCardName2 = dealtCards[9]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[3]
                    player4PPCardName2 = dealtCards[8]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player4PPCardName1 = dealtCards[4]
                    player4PPCardName2 = dealtCards[10]

                    player4PPCardFileName1 = GetCardFileName(player4PPCardName1)
                    player4PPCardFileName2 = GetCardFileName(player4PPCardName2)

                end

                if player4PPCardFileName1 then
                    sideBetWinFramePP.player4PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4PPCardFileName1)
                else
                    print("Card image filename not found for " .. player4PPCardName1)
                end
                if player4PPCardFileName2 then
                    sideBetWinFramePP.player4PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player4PPCardFileName2)
                else
                    print("Card image filename not found for " .. player4PPCardName2)
                end

                if playerName == unitName4 then
                    player4MixedPairNotification()
                end

                if string.find(message, "congratulations") then
                    player4MixedPairWin()
                else
                    print("")
                end  

            elseif string.find(message, "Player 5") then

                -- Players: 5
                if not player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[1]
                    player5PPCardName2 = dealtCards[3]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 5
                elseif player1Active and not player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 5
                elseif not player1Active and player2Active and not player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 3, 5
                elseif not player1Active and not player2Active and player3Active and not player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 4, 5
                elseif not player1Active and not player2Active and not player3Active and player4Active and player5Active then
                    player5PPCardName1 = dealtCards[2]
                    dealer213CardName1 = dealtCards[3]
                    player5PPCardName2 = dealtCards[5]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 5
                elseif player1Active and player2Active and not player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 3, 5
                elseif player1Active and not player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 4, 5
                elseif player1Active and not player2Active and notPlayer3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 3, 5
                elseif not player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 4, 5
                elseif not player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 3, 4, 5
                elseif not player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[3]
                    dealer213CardName1 = dealtCards[4]
                    player5PPCardName2 = dealtCards[7]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 3, 5
                elseif player1Active and player2Active and player3Active and not player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 4, 5
                elseif player1Active and player2Active and not player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 3, 4, 5
                elseif player1Active and not player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 2, 3, 4, 5
                elseif not player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[4]
                    dealer213CardName1 = dealtCards[5]
                    player5PPCardName2 = dealtCards[9]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)

                -- Players: 1, 2, 3, 4, 5
                elseif player1Active and player2Active and player3Active and player4Active and player5Active then    
                    player5PPCardName1 = dealtCards[5]
                    dealer213CardName1 = dealtCards[6]
                    player5PPCardName2 = dealtCards[11]

                    player5PPCardFileName1 = GetCardFileName(player5PPCardName1)
                    player5PPCardFileName2 = GetCardFileName(player5PPCardName2)
                end

                if player5PPCardFileName1 then
                    sideBetWinFramePP.player5PPCardImage1:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5PPCardFileName1)
                else
                    print("Card image filename not found for " .. player5PPCardName1)
                end
                if player5PPCardFileName2 then
                    sideBetWinFramePP.player5PPCardImage2:SetTexture("Interface\\AddOns\\BlackjackPlayerSOD\\Images\\" .. player5PPCardFileName2)
                else
                    print("Card image filename not found for " .. player5PPCardName2)
                end

                if playerName == unitName5 then
                    player5MixedPairNotification()
                end

                if string.find(message, "congratulations") then
                    player5MixedPairWin()
                else
                    print("")
                end
                
            end
        end
    end
    AddMessageToScrollFrame(message, sender)
end)

-- Chat event to listen for raid leader chat messages (v.2)
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("CHAT_MSG_RAID_LEADER")
eventFrame:SetScript("OnEvent", function(self, event, message, sender)

    if sender == "Hyrav-LivingFlame" or "Blackjack-ChaosBolt" or UnitIsGroupLeader(sender,"raid") then
        if string.find(message, "{diamond} Mixed Pair:") then
            usingThisToAvoidUpvalues5 = tonumber(string.match(message, "(%d+):"))
            mixedPairPayoutValue = usingThisToAvoidUpvalues5
            mixedPairPayoutReturn = mixedPairPayoutValue + 1
            payoutsFrame.mixedPairPayout:SetText(mixedPairPayoutValue .. ":1")
        elseif string.find(message, "{diamond} Coloured Pair:") then
            usingThisToAvoidUpvalues6 = tonumber(string.match(message, "(%d+):"))
            colouredPairPayoutValue = usingThisToAvoidUpvalues6
            colouredPairPayoutReturn = colouredPairPayoutValue + 1
            payoutsFrame.colouredPairPayout:SetText(colouredPairPayoutValue .. ":1")
        elseif string.find(message, "{diamond} Perfect Pair:") then
            usingThisToAvoidUpvalues7 = tonumber(string.match(message, "(%d+):"))
            perfectPairPayoutValue = usingThisToAvoidUpvalues7
            perfectPairPayoutReturn = perfectPairPayoutValue + 1
            payoutsFrame.perfectPairPayout:SetText(perfectPairPayoutValue .. ":1")
        elseif string.find(message, "{diamond} Flush:") then
            usingThisToAvoidUpvalues8 = tonumber(string.match(message, "(%d+):"))
            flushPayoutValue = usingThisToAvoidUpvalues8
            flushPayoutReturn = flushPayoutValue + 1
            payoutsFrame.flushPayout:SetText(flushPayoutValue .. ":1")
        elseif string.find(message, "{diamond} Straight:") then
            usingThisToAvoidUpvalues9 = tonumber(string.match(message, "(%d+):"))
            straightPayoutValue = usingThisToAvoidUpvalues9
            straightPayoutReturn = straightPayoutValue + 1
            payoutsFrame.straightPayout:SetText(straightPayoutValue .. ":1")
        elseif string.find(message, "{diamond} Three of a Kind:") then
            usingThisToAvoidUpvalues10 = tonumber(string.match(message, "(%d+):"))
            threeOfAKindPayoutValue = usingThisToAvoidUpvalues10
            threeOfAKindPayoutReturn = threeOfAKindPayoutValue + 1
            payoutsFrame.threeOfAKindPayout:SetText(threeOfAKindPayoutValue .. ":1")
        elseif string.find(message, "{diamond} Straight Flush:") then
            usingThisToAvoidUpvalues11 = tonumber(string.match(message, "(%d+):"))
            straightFlushPayoutValue = usingThisToAvoidUpvalues11
            straightFlushPayoutReturn = straightFlushPayoutValue + 1
            payoutsFrame.straightFlushPayout:SetText(straightFlushPayoutValue .. ":1")
        elseif string.find(message, "{diamond} Suited Three of a Kind:") then
            usingThisToAvoidUpvalues12 = tonumber(string.match(message, "(%d+):"))
            suitedThreeOfAKindPayoutValue = usingThisToAvoidUpvalues12
            suitedThreeOfAKindPayoutReturn = suitedThreeOfAKindPayoutValue + 1
            payoutsFrame.suitedThreeOfAKindPayout:SetText(suitedThreeOfAKindPayoutValue .. ":1")
        end
    end
end)

-- Register the event handler for system messages
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("CHAT_MSG_SYSTEM")
eventFrame:SetScript("OnEvent", function(self, event, arg1)
    if event == "CHAT_MSG_SYSTEM" then
        -- Extract sender from the system message
        local sender = string.match(arg1, "(%S+) rolls %d+ %(.-%d+%-(%d+)%)")
        if sender then
            AddMessageToScrollFrame(arg1, sender)
        end
    end
end)








-- >> PLAYER 1 <<
-- >> PLAYER 1 <<
-- >> PLAYER 1 <<

playerFrame.takeSeat1Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = false
    SendChatMessage("{circle} " .. playerName .. " has sat down in Seat 1.", "RAID")
    if playerBankingInfo[playerName] then
        local bankingInfo = playerBankingInfo[playerName]
        player1totalBetAmount = bankingInfo.totalWagered
        player1totalWin = bankingInfo.totalWon
        player1totalLoss = bankingInfo.totalLost
        player1totalProfit = bankingInfo.totalProfit
        player1TotalBankrollAmount = bankingInfo.bankrollTable
    else
    end
    tipDealerEditBox:Enable()
    playerFrame.reportButton:Enable()
    playerFrame.tipButton:Enable()
    player1PreloadBetButton:Show()
    player1PreloadEditBoxMainBet:Show()
    player1PreloadEditBoxPPBet:Show()
    player1PreloadEditBox213Bet:Show()
    playerFrame.leaveSeat1Button:Show()
    playerFrame.player1HitButton:Show()
    playerFrame.player1StandButton:Show()
    playerFrame.player1DoubleButton:Show()
    playerFrame.player1SplitButton:Show()
    playerFrame.player1DealNowButton:Show()
    player1ConfirmMainBetButton:Show()
    player1ConfirmPPBetButton:Show()
    player1Confirm213BetButton:Show()
    player1MainBetEditBox:Show()
    player1PPBetEditBox:Show()
    player1213BetEditBox:Show()
    playerFrame.player1MainBetTitle:Show()
    playerFrame.player1PPBetTitle:Show()
    playerFrame.player1213BetTitle:Show()
    --menuFrame.cardsButton:Enable()
    playerFrame.historyButton:Enable()
    menuFrame.preloadButton:Enable()
    playerFrame.cashDeskButton:Enable()
    playerFrame.takeSeat1Button:Hide()
    playerFrame.takeSeat2Button:Disable()
    playerFrame.takeSeat3Button:Disable()
    playerFrame.takeSeat4Button:Disable()
    playerFrame.takeSeat5Button:Disable()
    bankrollFrame.BaseTextDisplay:Hide()
    cashDeskFrame.player1TotalBankroll:Show()
    bankrollFrame.player1TotalBankrollTableDisplay:Show()
    historyFrame.player1totalWageredAmount:Show()
    historyFrame.player1totalWonAmount:Show()
    historyFrame.player1totalLostAmount:Show()
    historyFrame.player1ProfitAmount:Show()


    seatFrame:Show()
    seatFrame.seat1:SetAlpha(1)
    seatFrame.seat1:Show()
    ResetSeatFrame1()
    StartSeat1FadeOut()
    
end)
playerFrame.leaveSeat1Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = true
    SendChatMessage("{circle} " .. playerName .. " has left Seat 1.", "RAID")

    local wageredString = historyFrame.player1totalWageredAmount:GetText()
    local wonString = historyFrame.player1totalWonAmount:GetText()
    local lostString = historyFrame.player1totalLostAmount:GetText()
    local profitString = historyFrame.player1ProfitAmount:GetText()
    local bankrollString = bankrollFrame.player1TotalBankrollTableDisplay:GetText()

    local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
    local wonAmount = tonumber(string.match(wonString, "(%d+)"))
    local lostAmount = tonumber(string.match(lostString, "(%d+)"))
    local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
    local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

    -- Store banking information for the leaving player
    if wageredAmount then
        playerBankingInfo[playerName] = {
            totalWagered = wageredAmount,
            totalWon = wonAmount,
            totalLost = lostAmount,
            totalProfit = profitAmount,
            bankrollTable = bankrollAmount,
            bankrollCashDesk = bankrollAmount
        }
    else
        print("wageredAmount == nil")
    end
    tipDealerEditBox:Disable()
    playerFrame.reportButton:Disable()
    playerFrame.tipButton:Disable()
    player1dealtCardsFrame:Hide()
    player1dealtCardsFrameSplitH1:Hide()
    player1dealtCardsFrameSplitH2:Hide()
    player1PreloadBetButton:Hide()
    player1PreloadEditBoxMainBet:Hide()
    player1PreloadEditBoxPPBet:Hide()
    player1PreloadEditBox213Bet:Hide()
    playerFrame.leaveSeat1Button:Hide()
    playerFrame.player1HitButton:Hide()
    playerFrame.player1StandButton:Hide()
    playerFrame.player1DoubleButton:Hide()
    playerFrame.player1SplitButton:Hide()
    playerFrame.player1DealNowButton:Hide()
    playerFrame.player1InsuranceYesButton:Hide()
    playerFrame.player1InsuranceNoButton:Hide()
    player1ConfirmMainBetButton:Hide()
    player1ConfirmPPBetButton:Hide()
    player1Confirm213BetButton:Hide()
    player1MainBetEditBox:Hide()
    player1PPBetEditBox:Hide()
    player1213BetEditBox:Hide()
    playerFrame.player1MainBetTitle:Hide()
    playerFrame.player1PPBetTitle:Hide()
    playerFrame.player1213BetTitle:Hide()
    playerFrame.player1InsuranceTitle:Hide()
    playerFrame.player1InsuranceSubtitle:Hide()
    menuFrame.cardsButton:Disable()
    playerFrame.historyButton:Disable()
    menuFrame.preloadButton:Disable()
    playerFrame.cashDeskButton:Disable()
    playerFrame.takeSeat1Button:Show()
    if playerFrame.player2Name:GetText() == "Seat Empty" then    
        playerFrame.takeSeat2Button:Enable()
    end
    if playerFrame.player3Name:GetText() == "Seat Empty" then  
        playerFrame.takeSeat3Button:Enable()
    end
    if playerFrame.player4Name:GetText() == "Seat Empty" then 
        playerFrame.takeSeat4Button:Enable()
    end
    if playerFrame.player5Name:GetText() == "Seat Empty" then
        playerFrame.takeSeat5Button:Enable()
    end
    cashDeskFrame.player1TotalBankroll:Hide()
    historyFrame:Hide()
    preloadFrame:Hide()
    historyFrame.player1totalWageredAmount:Hide()
    historyFrame.player1totalWonAmount:Hide()
    historyFrame.player1totalLostAmount:Hide()
    historyFrame.player1ProfitAmount:Hide()
    bankrollFrame.player1TotalBankrollTableDisplay:Hide()
    bankrollFrame.BaseTextDisplay:Show()

    seatFrame:Hide()
    seatFrame.seat1:Hide()
end)
playerFrame.player1InsuranceYesButton:SetScript("OnClick", function()

    player1MainBet = tonumber(player1MainBetEditBox:GetText())
    player1InsuranceValue = player1MainBet / 2
    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1currentBankroll - player1InsuranceValue < 0 then
        print("You do not have enough gold in your bankroll to take insurance. Please visit the Cash Desk.")
    else
        player1InsuranceYesIcon:Show()
        playerFrame.player1InsuranceYesButton:Disable()
        playerFrame.player1InsuranceNoButton:Disable()

        if player1MainBet then
            SendChatMessage("[P1] YES to Insurance - adding " .. player1InsuranceValue .. "G", "RAID")         
            playerFrame.player1InsuranceBetAmount:SetText(player1InsuranceValue .. " G")
        end

        if playerBankingInfo[unitName1] then
            local bankingInfo = playerBankingInfo[unitName1]
            player1totalBetAmount = bankingInfo.totalWagered + tonumber(player1InsuranceValue)
            bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(player1InsuranceValue)
            player1TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(player1InsuranceValue)
            bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(player1InsuranceValue)
        else
            player1totalBetAmount = player1totalBetAmount + tonumber(player1InsuranceValue)
            player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(player1InsuranceValue)
        end

        historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")
        bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
        cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
    end
end)
playerFrame.player1InsuranceNoButton:SetScript("OnClick", function()
    player1InsuranceNoIcon:Show()
    playerFrame.player1InsuranceYesButton:Disable()
    playerFrame.player1InsuranceNoButton:Disable()
    SendChatMessage("[P1] NO to Insurance", "RAID")
end)
playerFrame.player1HitButton:SetScript("OnClick", function()
    -- Handle the "hit" button action
    SendChatMessage("[P1] Hit", "RAID")
    playerFrame.player1HitButton:Disable()
    playerFrame.player1StandButton:Disable()
    playerFrame.player1DoubleButton:Disable()
    playerFrame.player1SplitButton:Disable()
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player1InsuranceYesButton:IsEnabled() and playerFrame.player1InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P1] NO to Insurance", "RAID")
        playerFrame.player1InsuranceYesButton:Disable()
        playerFrame.player1InsuranceNoButton:Disable()
        player1InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[34])
    player1DoubleToggle = true
    timerReset()
end)
playerFrame.player1HitButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P1] (H1) Hit", "RAID")
    playerFrame.player1HitButtonSplitH1:Disable()
    playerFrame.player1StandButtonSplitH1:Disable()
    playerFrame.player1DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[34])
    player1DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player1HitButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P1] (H2) Hit", "RAID")
    playerFrame.player1HitButtonSplitH2:Disable()
    playerFrame.player1StandButtonSplitH2:Disable()
    playerFrame.player1DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[34])
    player1DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player1StandButton:SetScript("OnClick", function()
    -- Handle the "stand" button action
    SendChatMessage("[P1] Stand", "RAID")
    playerFrame.player1HitButton:Disable()
    playerFrame.player1StandButton:Disable()
    playerFrame.player1DoubleButton:Disable()
    playerFrame.player1SplitButton:Disable()
    timerFrame.player1TimerText:SetText("")
    timerFrame.player1TimerText:Hide()
    if playerFrame.player1CardTotalText:GetText() == "1 or 11" then
        playerFrame.player1CardTotalText:SetText("11")
    elseif playerFrame.player1CardTotalText:GetText() == "2 or 12" then
        playerFrame.player1CardTotalText:SetText("12")
    elseif playerFrame.player1CardTotalText:GetText() == "3 or 13" then
        playerFrame.player1CardTotalText:SetText("13")
    elseif playerFrame.player1CardTotalText:GetText() == "4 or 14" then
        playerFrame.player1CardTotalText:SetText("14")
    elseif playerFrame.player1CardTotalText:GetText() == "5 or 15" then
        playerFrame.player1CardTotalText:SetText("15")
    elseif playerFrame.player1CardTotalText:GetText() == "6 or 16" then
        playerFrame.player1CardTotalText:SetText("16")
    elseif playerFrame.player1CardTotalText:GetText() == "7 or 17" then
        playerFrame.player1CardTotalText:SetText("17")
    elseif playerFrame.player1CardTotalText:GetText() == "8 or 18" then
        playerFrame.player1CardTotalText:SetText("18")
    elseif playerFrame.player1CardTotalText:GetText() == "9 or 19" then
        playerFrame.player1CardTotalText:SetText("19")
    elseif playerFrame.player1CardTotalText:GetText() == "10 or 20" then
        playerFrame.player1CardTotalText:SetText("20")
    end
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player1InsuranceYesButton:IsEnabled() and playerFrame.player1InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P1] NO to Insurance", "RAID")
        playerFrame.player1InsuranceYesButton:Disable()
        playerFrame.player1InsuranceNoButton:Disable()
        player1InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[35])
    player1DoubleToggle = true
    timerReset()
end)
playerFrame.player1StandButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P1] (H1) Stand", "RAID")
    playerFrame.player1HitButtonSplitH1:Disable()
    playerFrame.player1StandButtonSplitH1:Disable()
    playerFrame.player1DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[35])
    player1DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player1StandButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P1] (H2) Stand", "RAID")
    playerFrame.player1HitButtonSplitH2:Disable()
    playerFrame.player1StandButtonSplitH2:Disable()
    playerFrame.player1DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[35])
    player1DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player1DoubleButton:SetScript("OnClick", function()

    player1MainBet = tonumber(player1MainBetEditBox:GetText())
    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1currentBankroll - player1MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
        local betDoubleAmount1 = 0
        betAmount1 = tonumber(player1MainBetEditBox:GetText()) -- Get the entered bet amount
        if betAmount1 then
            betDoubleAmount1 = betAmount1 * 2
            SendChatMessage("[P1] Double my bet to " ..betDoubleAmount1.. "G", "RAID")
            player1MainBetEditBox:SetText(betDoubleAmount1)
            player1MainBetAmount:SetText(betDoubleAmount1)
            playerFrame.player1HitButton:Disable()
            playerFrame.player1StandButton:Disable()
            playerFrame.player1DoubleButton:Disable()
            playerFrame.player1SplitButton:Disable()
            timerFrame.player1TimerText:SetText("")
            timerFrame.player1TimerText:Hide()
            countdownDuration = 30

            if playerBankingInfo[unitName1] then
                local bankingInfo = playerBankingInfo[unitName1]
                player1totalBetAmount = bankingInfo.totalWagered + tonumber(betAmount1)
                bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(betAmount1)
                player1TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmount1)
                bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(betAmount1)
            else
                player1totalBetAmount = player1totalBetAmount + tonumber(betAmount1)
                player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(betAmount1)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")

        end
        if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player1InsuranceYesButton:IsEnabled() and playerFrame.player1InsuranceNoButton:IsEnabled() then
            SendChatMessage("[P1] NO to Insurance", "RAID")
            playerFrame.player1InsuranceYesButton:Disable()
            playerFrame.player1InsuranceNoButton:Disable()
            player1InsuranceNoIcon:Show()
        end
        PlaySoundFile(soundFilePaths[36])
        player1DoubleToggle = true
        timerReset()

    end
end)
playerFrame.player1DoubleButtonSplitH1:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player1SplitH1MainBet = tonumber(player1SplitH1EditBox:GetText())
    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1currentBankroll - player1SplitH1MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
    
        local betDoubleAmountSplitH1 = 0
        betAmountSplitH1 = tonumber(string.match(player1SplitH1BetAmount:GetText(), "%d+"))
        if betAmountSplitH1 then
            betDoubleAmountSplitH1 = betAmountSplitH1 * 2
            SendChatMessage("[P1] (H1) Double my bet to " ..betDoubleAmountSplitH1.. "G", "RAID")
            player1SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            playerFrame.player1HitButtonSplitH1:Disable()
            playerFrame.player1StandButtonSplitH1:Disable()
            playerFrame.player1DoubleButtonSplitH1:Disable()
            player1DoubleHand1Toggle = true
            timerReset()

            player1SplitH1EditBox:SetText(betDoubleAmountSplitH1)

            if playerBankingInfo[unitName1] then
                local bankingInfo = playerBankingInfo[unitName1]
                player1totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH1)
                bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(betAmountSplitH1)
                player1TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH1)
                bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(betAmountSplitH1)
            else
                player1totalBetAmount = player1totalBetAmount + tonumber(betAmountSplitH1)
                player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(betAmountSplitH1)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")

        end
    end
end)
playerFrame.player1DoubleButtonSplitH2:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player1SplitH2MainBet = tonumber(player1SplitH2EditBox:GetText())
    player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

    if player1currentBankroll - player1SplitH2MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else

        local betDoubleAmountSplitH2 = 0
        betAmountSplitH2 = tonumber(string.match(player1SplitH2BetAmount:GetText(), "%d+"))
        if betAmountSplitH2 then
            betDoubleAmountSplitH2 = betAmountSplitH2 * 2
            SendChatMessage("[P1] (H2) Double my bet to " ..betDoubleAmountSplitH2.. "G", "RAID")
            player1SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            playerFrame.player1HitButtonSplitH2:Disable()
            playerFrame.player1StandButtonSplitH2:Disable()
            playerFrame.player1DoubleButtonSplitH2:Disable()
            player1DoubleHand2Toggle = true
            timerReset()

            player1SplitH2EditBox:SetText(betDoubleAmountSplitH2)

            if playerBankingInfo[unitName1] then
                local bankingInfo = playerBankingInfo[unitName1]
                player1totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                player1TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
                bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
            else
                player1totalBetAmount = player1totalBetAmount + tonumber(betAmountSplitH2)
                player1TotalBankrollAmount = player1TotalBankrollAmount - tonumber(betAmountSplitH2)
            end

            bankrollFrame.player1TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            cashDeskFrame.player1TotalBankroll:SetText("Total Bankroll: " .. player1TotalBankrollAmount .. " G")
            historyFrame.player1totalWageredAmount:SetText(player1totalBetAmount .. " G")

        end
    end
end)
playerFrame.player1SplitButton:SetScript("OnClick", function()
    if playerFrame.player1HitButton:IsEnabled() then
        PlaySoundFile(soundFilePaths[37])
        player1MainBet = tonumber(player1MainBetEditBox:GetText())
        player1currentBankroll = tonumber(string.match(bankrollFrame.player1TotalBankrollTableDisplay:GetText(), "%d+"))

        if player1currentBankroll - player1MainBet < 0 then
            print("You do not have enough gold in your bankroll to split your hand. Please visit the Cash Desk.")
        else

            SendChatMessage("[P1] Split", "RAID")
            playerFrame.player1HitButton:Hide()
            playerFrame.player1StandButton:Hide()
            playerFrame.player1DoubleButton:Hide()
            playerFrame.player1SplitButton:Hide()
            playerFrame.player1InsuranceYesButton:Hide()
            playerFrame.player1InsuranceNoButton:Hide()
            playerFrame.player1InsuranceTitle:Hide()
            playerFrame.player1InsuranceSubtitle:Hide()
            player1ConfirmMainBetButton:Hide()
            player1MainBetEditBox:Hide()
            playerFrame.player1MainBetTitle:Hide()
            

            playerFrame.player1SplitH1Title:Show()
            playerFrame.player1SplitH2Title:Show()
            player1SplitH1EditBox:Show()
            player1SplitH2EditBox:Show()
            playerFrame.player1HitButtonSplitH1:Show()
            playerFrame.player1StandButtonSplitH1:Show()
            playerFrame.player1DoubleButtonSplitH1:Show()
            playerFrame.player1HitButtonSplitH2:Show()
            playerFrame.player1StandButtonSplitH2:Show()
            playerFrame.player1DoubleButtonSplitH2:Show()

            betAmount1 = tonumber(player1MainBetEditBox:GetText())
            if betAmount1 then
                player1SplitH1EditBox:SetText(betAmount1)
                player1SplitH2EditBox:SetText(betAmount1)
            end

            if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player1InsuranceYesButton:IsEnabled() and playerFrame.player1InsuranceNoButton:IsEnabled() then
                SendChatMessage("[P1] NO to Insurance", "RAID")
                playerFrame.player1InsuranceYesButton:Disable()
                playerFrame.player1InsuranceNoButton:Disable()
                player1InsuranceNoIcon:Show()
            end

            timerReset()
        end
    else
        print("You must wait until its your turn.")
    end
end)
playerFrame.player1DealNowButton:SetScript("OnClick", function()
    SendChatMessage("{moon} " .. playerName .. " has indicated they are ready.", "RAID")
    -- Player 1 bet buttons disabled
    player1ConfirmMainBetButton:Disable()
    player1ConfirmPPBetButton:Disable()
    player1Confirm213BetButton:Disable()
    player1PreloadBetButton:Disable()
    playerFrame.player1DealNowButton:Disable()
end)



-- >> PLAYER 2 <<
-- >> PLAYER 2 <<
-- >> PLAYER 2 <<

playerFrame.takeSeat2Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = false
    SendChatMessage("{circle} " .. playerName .. " has sat down in Seat 2.", "RAID")
    if playerBankingInfo[playerName] then
        local bankingInfo = playerBankingInfo[playerName]
        player2totalBetAmount = bankingInfo.totalWagered
        player2totalWin = bankingInfo.totalWon
        player2totalLoss = bankingInfo.totalLost
        player2totalProfit = bankingInfo.totalProfit
        player2TotalBankrollAmount = bankingInfo.bankrollTable
    else
    end
    tipDealerEditBox:Enable()
    playerFrame.reportButton:Enable()
    playerFrame.tipButton:Enable()
    player2PreloadBetButton:Show()
    player2PreloadEditBoxMainBet:Show()
    player2PreloadEditBoxPPBet:Show()
    player2PreloadEditBox213Bet:Show()
    playerFrame.leaveSeat2Button:Show()
    playerFrame.player2HitButton:Show()
    playerFrame.player2StandButton:Show()
    playerFrame.player2DoubleButton:Show()
    playerFrame.player2SplitButton:Show()
    playerFrame.player2DealNowButton:Show()
    player2ConfirmMainBetButton:Show()
    player2ConfirmPPBetButton:Show()
    player2Confirm213BetButton:Show()
    player2MainBetEditBox:Show()
    player2PPBetEditBox:Show()
    player2213BetEditBox:Show()
    playerFrame.player2MainBetTitle:Show()
    playerFrame.player2PPBetTitle:Show()
    playerFrame.player2213BetTitle:Show()
    --menuFrame.cardsButton:Enable()
    playerFrame.historyButton:Enable()
    menuFrame.preloadButton:Enable()
    playerFrame.cashDeskButton:Enable()
    playerFrame.takeSeat1Button:Disable()
    playerFrame.takeSeat2Button:Hide()
    playerFrame.takeSeat3Button:Disable()
    playerFrame.takeSeat4Button:Disable()
    playerFrame.takeSeat5Button:Disable()
    bankrollFrame.BaseTextDisplay:Hide()
    cashDeskFrame.player2TotalBankroll:Show()
    bankrollFrame.player2TotalBankrollTableDisplay:Show()
    historyFrame.player2totalWageredAmount:Show()
    historyFrame.player2totalWonAmount:Show()
    historyFrame.player2totalLostAmount:Show()
    historyFrame.player2ProfitAmount:Show()
    seatFrame:Show()
    seatFrame.seat2:SetAlpha(1)
    seatFrame.seat2:Show()
    ResetSeatFrame2()
    StartSeat2FadeOut()
end)
playerFrame.leaveSeat2Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = true
    SendChatMessage("{circle} " .. playerName .. " has left Seat 2.", "RAID")

    local wageredString = historyFrame.player2totalWageredAmount:GetText()
    local wonString = historyFrame.player2totalWonAmount:GetText()
    local lostString = historyFrame.player2totalLostAmount:GetText()
    local profitString = historyFrame.player2ProfitAmount:GetText()
    local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()

    local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
    local wonAmount = tonumber(string.match(wonString, "(%d+)"))
    local lostAmount = tonumber(string.match(lostString, "(%d+)"))
    local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
    local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

    -- Store banking information for the leaving player
    if wageredAmount then
        playerBankingInfo[playerName] = {
            totalWagered = wageredAmount,
            totalWon = wonAmount,
            totalLost = lostAmount,
            totalProfit = profitAmount,
            bankrollTable = bankrollAmount,
            bankrollCashDesk = bankrollAmount
        }
    else
        print("wageredAmount == nil")
    end
    tipDealerEditBox:Disable()
    playerFrame.reportButton:Disable()
    playerFrame.tipButton:Disable()
    player2dealtCardsFrame:Hide()
    player2dealtCardsFrameSplitH1:Hide()
    player2dealtCardsFrameSplitH2:Hide()
    player2PreloadBetButton:Hide()
    player2PreloadEditBoxMainBet:Hide()
    player2PreloadEditBoxPPBet:Hide()
    player2PreloadEditBox213Bet:Hide()
    playerFrame.leaveSeat2Button:Hide()
    playerFrame.player2HitButton:Hide()
    playerFrame.player2StandButton:Hide()
    playerFrame.player2DoubleButton:Hide()
    playerFrame.player2SplitButton:Hide()
    playerFrame.player2DealNowButton:Hide()
    playerFrame.player2InsuranceYesButton:Hide()
    playerFrame.player2InsuranceNoButton:Hide()
    player2ConfirmMainBetButton:Hide()
    player2ConfirmPPBetButton:Hide()
    player2Confirm213BetButton:Hide()
    player2MainBetEditBox:Hide()
    player2PPBetEditBox:Hide()
    player2213BetEditBox:Hide()
    playerFrame.player2MainBetTitle:Hide()
    playerFrame.player2PPBetTitle:Hide()
    playerFrame.player2213BetTitle:Hide()
    playerFrame.player2InsuranceTitle:Hide()
    playerFrame.player2InsuranceSubtitle:Hide()
    menuFrame.cardsButton:Disable()
    playerFrame.historyButton:Disable()
    menuFrame.preloadButton:Disable()
    playerFrame.cashDeskButton:Disable()
    playerFrame.takeSeat2Button:Show()
    if playerFrame.player1Name:GetText() == "Seat Empty" then    
        playerFrame.takeSeat1Button:Enable()
    end
    if playerFrame.player3Name:GetText() == "Seat Empty" then  
        playerFrame.takeSeat3Button:Enable()
    end
    if playerFrame.player4Name:GetText() == "Seat Empty" then 
        playerFrame.takeSeat4Button:Enable()
    end
    if playerFrame.player5Name:GetText() == "Seat Empty" then
        playerFrame.takeSeat5Button:Enable()
    end
    cashDeskFrame.player2TotalBankroll:Hide()
    historyFrame:Hide()
    preloadFrame:Hide()
    historyFrame.player2totalWageredAmount:Hide()
    historyFrame.player2totalWonAmount:Hide()
    historyFrame.player2totalLostAmount:Hide()
    historyFrame.player2ProfitAmount:Hide()
    bankrollFrame.player2TotalBankrollTableDisplay:Hide()
    bankrollFrame.BaseTextDisplay:Show()
    seatFrame:Hide()
    seatFrame.seat2:Hide()
end)
playerFrame.player2InsuranceYesButton:SetScript("OnClick", function()

    player2MainBet = tonumber(player2MainBetEditBox:GetText())
    player2InsuranceValue = player2MainBet / 2
    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2currentBankroll - player2InsuranceValue < 0 then
        print("You do not have enough gold in your bankroll to take insurance. Please visit the Cash Desk.")
    else
        player2InsuranceYesIcon:Show()
        playerFrame.player2InsuranceYesButton:Disable()
        playerFrame.player2InsuranceNoButton:Disable()

        if player2MainBet then
            SendChatMessage("[P2] YES to Insurance - adding " .. player2InsuranceValue .. "G", "RAID")         
            playerFrame.player2InsuranceBetAmount:SetText(player2InsuranceValue .. " G")
        end

        if playerBankingInfo[unitName2] then
            local bankingInfo = playerBankingInfo[unitName2]
            player2totalBetAmount = bankingInfo.totalWagered + tonumber(player2InsuranceValue)
            player2TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(player2InsuranceValue)
        else
            player2totalBetAmount = player2totalBetAmount + tonumber(player2InsuranceValue)
            player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(player2InsuranceValue)
        end

        historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")
        bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
        cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
    end
end)
playerFrame.player2InsuranceNoButton:SetScript("OnClick", function()
    player2InsuranceNoIcon:Show()
    playerFrame.player2InsuranceYesButton:Disable()
    playerFrame.player2InsuranceNoButton:Disable()
    SendChatMessage("[P2] NO to Insurance", "RAID")
end)
playerFrame.player2HitButton:SetScript("OnClick", function()
    -- Handle the "hit" button action
    SendChatMessage("[P2] Hit", "RAID")
    playerFrame.player2HitButton:Disable()
    playerFrame.player2StandButton:Disable()
    playerFrame.player2DoubleButton:Disable()
    playerFrame.player2SplitButton:Disable()
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player2InsuranceYesButton:IsEnabled() and playerFrame.player2InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P2] NO to Insurance", "RAID")
        playerFrame.player2InsuranceYesButton:Disable()
        playerFrame.player2InsuranceNoButton:Disable()
        player2InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[34])
    player2DoubleToggle = true
    timerReset()
end)
playerFrame.player2HitButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P2] (H1) Hit", "RAID")
    playerFrame.player2HitButtonSplitH1:Disable()
    playerFrame.player2StandButtonSplitH1:Disable()
    playerFrame.player2DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[34])
    player2DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player2HitButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P2] (H2) Hit", "RAID")
    playerFrame.player2HitButtonSplitH2:Disable()
    playerFrame.player2StandButtonSplitH2:Disable()
    playerFrame.player2DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[34])
    player2DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player2StandButton:SetScript("OnClick", function()
    -- Handle the "stand" button action
    SendChatMessage("[P2] Stand", "RAID")
    playerFrame.player2HitButton:Disable()
    playerFrame.player2StandButton:Disable()
    playerFrame.player2DoubleButton:Disable()
    playerFrame.player2SplitButton:Disable()
    timerFrame.player2TimerText:SetText("")
    timerFrame.player2TimerText:Hide()
    if playerFrame.player2CardTotalText:GetText() == "1 or 11" then
        playerFrame.player2CardTotalText:SetText("11")
    elseif playerFrame.player2CardTotalText:GetText() == "2 or 12" then
        playerFrame.player2CardTotalText:SetText("12")
    elseif playerFrame.player2CardTotalText:GetText() == "3 or 13" then
        playerFrame.player2CardTotalText:SetText("13")
    elseif playerFrame.player2CardTotalText:GetText() == "4 or 14" then
        playerFrame.player2CardTotalText:SetText("14")
    elseif playerFrame.player2CardTotalText:GetText() == "5 or 15" then
        playerFrame.player2CardTotalText:SetText("15")
    elseif playerFrame.player2CardTotalText:GetText() == "6 or 16" then
        playerFrame.player2CardTotalText:SetText("16")
    elseif playerFrame.player2CardTotalText:GetText() == "7 or 17" then
        playerFrame.player2CardTotalText:SetText("17")
    elseif playerFrame.player2CardTotalText:GetText() == "8 or 18" then
        playerFrame.player2CardTotalText:SetText("18")
    elseif playerFrame.player2CardTotalText:GetText() == "9 or 19" then
        playerFrame.player2CardTotalText:SetText("19")
    elseif playerFrame.player2CardTotalText:GetText() == "10 or 20" then
        playerFrame.player2CardTotalText:SetText("20")
    end
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player2InsuranceYesButton:IsEnabled() and playerFrame.player2InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P2] NO to Insurance", "RAID")
        playerFrame.player2InsuranceYesButton:Disable()
        playerFrame.player2InsuranceNoButton:Disable()
        player2InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[35])
    player2DoubleToggle = true
    timerReset()
end)
playerFrame.player2StandButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P2] (H1) Stand", "RAID")
    playerFrame.player2HitButtonSplitH1:Disable()
    playerFrame.player2StandButtonSplitH1:Disable()
    playerFrame.player2DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[35])
    player2DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player2StandButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P2] (H2) Stand", "RAID")
    playerFrame.player2HitButtonSplitH2:Disable()
    playerFrame.player2StandButtonSplitH2:Disable()
    playerFrame.player2DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[35])
    player2DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player2DoubleButton:SetScript("OnClick", function()

    player2MainBet = tonumber(player2MainBetEditBox:GetText())
    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2currentBankroll - player2MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
        local betDoubleAmount2 = 0
        betAmount2 = tonumber(player2MainBetEditBox:GetText()) -- Get the entered bet amount
        if betAmount2 then
            betDoubleAmount2 = betAmount2 * 2
            SendChatMessage("[P2] Double my bet to " ..betDoubleAmount2.. "G", "RAID")
            player2MainBetEditBox:SetText(betDoubleAmount2)
            player2MainBetAmount:SetText(betDoubleAmount2)
            playerFrame.player2HitButton:Disable()
            playerFrame.player2StandButton:Disable()
            playerFrame.player2DoubleButton:Disable() 
            timerFrame.player2TimerText:SetText("")
            timerFrame.player2TimerText:Hide()
            countdownDuration = 30

            if playerBankingInfo[unitName2] then
                local bankingInfo = playerBankingInfo[unitName2]
                player2totalBetAmount = bankingInfo.totalWagered + tonumber(betAmount2)
                player2TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmount2)
            else
                player2totalBetAmount = player2totalBetAmount + tonumber(betAmount2)
                player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(betAmount2)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")

        end
        if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player2InsuranceYesButton:IsEnabled() and playerFrame.player2InsuranceNoButton:IsEnabled() then
            SendChatMessage("[P2] NO to Insurance", "RAID")
            playerFrame.player2InsuranceYesButton:Disable()
            playerFrame.player2InsuranceNoButton:Disable()
            player2InsuranceNoIcon:Show()
        end
        PlaySoundFile(soundFilePaths[36])
        player2DoubleToggle = true
        timerReset()

    end
end)
playerFrame.player2DoubleButtonSplitH1:SetScript("OnClick", function()
    
    PlaySoundFile(soundFilePaths[36])
    player2SplitH1MainBet = tonumber(player2SplitH1EditBox:GetText())
    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2currentBankroll - player2SplitH1MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
    
        local betDoubleAmountSplitH1 = 0
        betAmountSplitH1 = tonumber(string.match(player2SplitH1BetAmount:GetText(), "%d+"))
        if betAmountSplitH1 then
            betDoubleAmountSplitH1 = betAmountSplitH1 * 2
            SendChatMessage("[P2] (H1) Double my bet to " ..betDoubleAmountSplitH1.. "G", "RAID")
            player2SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            playerFrame.player2HitButtonSplitH1:Disable()
            playerFrame.player2StandButtonSplitH1:Disable()
            playerFrame.player2DoubleButtonSplitH1:Disable()
            player2DoubleHand1Toggle = true
            timerReset()

            player2SplitH1EditBox:SetText(betDoubleAmountSplitH1)

            if playerBankingInfo[unitName2] then
                local bankingInfo = playerBankingInfo[unitName2]
                player2totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH1)
                player2TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH1)
            else
                player2totalBetAmount = player2totalBetAmount + tonumber(betAmountSplitH1)
                player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(betAmountSplitH1)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")

        end
    end
end)
playerFrame.player2DoubleButtonSplitH2:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player2SplitH2MainBet = tonumber(player2SplitH2EditBox:GetText())
    player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

    if player2currentBankroll - player2SplitH2MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else

        local betDoubleAmountSplitH2 = 0
        betAmountSplitH2 = tonumber(string.match(player2SplitH2BetAmount:GetText(), "%d+"))
        if betAmountSplitH2 then
            betDoubleAmountSplitH2 = betAmountSplitH2 * 2
            SendChatMessage("[P2] (H2) Double my bet to " ..betDoubleAmountSplitH2.. "G", "RAID")
            player2SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            playerFrame.player2HitButtonSplitH2:Disable()
            playerFrame.player2StandButtonSplitH2:Disable()
            playerFrame.player2DoubleButtonSplitH2:Disable()
            player2DoubleHand2Toggle = true
            timerReset()

            player2SplitH2EditBox:SetText(betDoubleAmountSplitH2)

            if playerBankingInfo[unitName2] then
                local bankingInfo = playerBankingInfo[unitName2]
                player2totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
                player2TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
            else
                player2totalBetAmount = player2totalBetAmount + tonumber(betAmountSplitH2)
                player2TotalBankrollAmount = player2TotalBankrollAmount - tonumber(betAmountSplitH2)
            end

            bankrollFrame.player2TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            cashDeskFrame.player2TotalBankroll:SetText("Total Bankroll: " .. player2TotalBankrollAmount .. " G")
            historyFrame.player2totalWageredAmount:SetText(player2totalBetAmount .. " G")

        end
    end
end)
playerFrame.player2SplitButton:SetScript("OnClick", function()
    if playerFrame.player2HitButton:IsEnabled() then
        PlaySoundFile(soundFilePaths[37])
        player2MainBet = tonumber(player2MainBetEditBox:GetText())
        player2currentBankroll = tonumber(string.match(bankrollFrame.player2TotalBankrollTableDisplay:GetText(), "%d+"))

        if playerFrame.player2HitButton:IsShown() then
            if player2currentBankroll - player2MainBet < 0 then
                print("You do not have enough gold in your bankroll to split your hand. Please visit the Cash Desk.")
            else

                SendChatMessage("[P2] Split", "RAID")
                playerFrame.player2HitButton:Hide()
                playerFrame.player2StandButton:Hide()
                playerFrame.player2DoubleButton:Hide()
                playerFrame.player2SplitButton:Hide()
                playerFrame.player2InsuranceYesButton:Hide()
                playerFrame.player2InsuranceNoButton:Hide()
                playerFrame.player2InsuranceTitle:Hide()
                playerFrame.player2InsuranceSubtitle:Hide()
                player2ConfirmMainBetButton:Hide()
                player2MainBetEditBox:Hide()
                playerFrame.player2MainBetTitle:Hide()
                

                playerFrame.player2SplitH1Title:Show()
                playerFrame.player2SplitH2Title:Show()
                player2SplitH1EditBox:Show()
                player2SplitH2EditBox:Show()
                playerFrame.player2HitButtonSplitH1:Show()
                playerFrame.player2StandButtonSplitH1:Show()
                playerFrame.player2DoubleButtonSplitH1:Show()
                playerFrame.player2HitButtonSplitH2:Show()
                playerFrame.player2StandButtonSplitH2:Show()
                playerFrame.player2DoubleButtonSplitH2:Show()

                betAmount2 = tonumber(player2MainBetEditBox:GetText())
                if betAmount2 then
                    player2SplitH1EditBox:SetText(betAmount2)
                    player2SplitH2EditBox:SetText(betAmount2)
                end

                if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player2InsuranceYesButton:IsEnabled() and playerFrame.player2InsuranceNoButton:IsEnabled() then
                    SendChatMessage("[P2] NO to Insurance", "RAID")
                    playerFrame.player2InsuranceYesButton:Disable()
                    playerFrame.player2InsuranceNoButton:Disable()
                    player2InsuranceNoIcon:Show()
                end

                timerReset()
            end
        else
            print("You must wait until its your turn.")
        end
    else
        print("You must wait until its your turn.")
    end  
end)
playerFrame.player2DealNowButton:SetScript("OnClick", function()
    SendChatMessage("{moon} " .. playerName .. " has indicated they are ready.", "RAID")
    -- Player 2 bet buttons disabled
    player2ConfirmMainBetButton:Disable()
    player2ConfirmPPBetButton:Disable()
    player2Confirm213BetButton:Disable()
    player2PreloadBetButton:Disable()
    playerFrame.player2DealNowButton:Disable()
end)




-- >> PLAYER 3 <<
-- >> PLAYER 3 <<
-- >> PLAYER 3 <<

playerFrame.takeSeat3Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = false
    SendChatMessage("{circle} " .. playerName .. " has sat down in Seat 3.", "RAID")
    if playerBankingInfo[playerName] then
        local bankingInfo = playerBankingInfo[playerName]
        player3totalBetAmount = bankingInfo.totalWagered
        player3totalWin = bankingInfo.totalWon
        player3totalLoss = bankingInfo.totalLost
        player3totalProfit = bankingInfo.totalProfit
        player3TotalBankrollAmount = bankingInfo.bankrollTable
    else
    end
    tipDealerEditBox:Enable()
    playerFrame.reportButton:Enable()
    playerFrame.tipButton:Enable()
    player3PreloadBetButton:Show()
    player3PreloadEditBoxMainBet:Show()
    player3PreloadEditBoxPPBet:Show()
    player3PreloadEditBox213Bet:Show()
    playerFrame.leaveSeat3Button:Show()
    playerFrame.player3HitButton:Show()
    playerFrame.player3StandButton:Show()
    playerFrame.player3DoubleButton:Show()
    playerFrame.player3SplitButton:Show()
    playerFrame.player3DealNowButton:Show()
    player3ConfirmMainBetButton:Show()
    player3ConfirmPPBetButton:Show()
    player3Confirm213BetButton:Show()
    player3MainBetEditBox:Show()
    player3PPBetEditBox:Show()
    player3213BetEditBox:Show()
    playerFrame.player3MainBetTitle:Show()
    playerFrame.player3PPBetTitle:Show()
    playerFrame.player3213BetTitle:Show()
    --menuFrame.cardsButton:Enable()
    playerFrame.historyButton:Enable()
    menuFrame.preloadButton:Enable()
    playerFrame.cashDeskButton:Enable()
    playerFrame.takeSeat1Button:Disable()
    playerFrame.takeSeat2Button:Disable()
    playerFrame.takeSeat3Button:Hide()
    playerFrame.takeSeat4Button:Disable()
    playerFrame.takeSeat5Button:Disable()
    cashDeskFrame.player3TotalBankroll:Show()
    bankrollFrame.player3TotalBankrollTableDisplay:Show()
    bankrollFrame.BaseTextDisplay:Hide()
    historyFrame.player3totalWageredAmount:Show()
    historyFrame.player3totalWonAmount:Show()
    historyFrame.player3totalLostAmount:Show()
    historyFrame.player3ProfitAmount:Show()
    seatFrame:Show()
    seatFrame.seat3:SetAlpha(1)
    seatFrame.seat3:Show()
    ResetSeatFrame3()
    StartSeat3FadeOut()
end)
playerFrame.leaveSeat3Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = true
    SendChatMessage("{circle} " .. playerName .. " has left Seat 3.", "RAID")
    local wageredString = historyFrame.player2totalWageredAmount:GetText()
    local wonString = historyFrame.player2totalWonAmount:GetText()
    local lostString = historyFrame.player2totalLostAmount:GetText()
    local profitString = historyFrame.player2ProfitAmount:GetText()
    local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()

    local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
    local wonAmount = tonumber(string.match(wonString, "(%d+)"))
    local lostAmount = tonumber(string.match(lostString, "(%d+)"))
    local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
    local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

    -- Store banking information for the leaving player
    if wageredAmount then
        playerBankingInfo[playerName] = {
            totalWagered = wageredAmount,
            totalWon = wonAmount,
            totalLost = lostAmount,
            totalProfit = profitAmount,
            bankrollTable = bankrollAmount,
            bankrollCashDesk = bankrollAmount
        }
    else
        print("wageredAmount == nil")
    end
    tipDealerEditBox:Disable()
    playerFrame.reportButton:Disable()
    playerFrame.tipButton:Disable()
    player3dealtCardsFrame:Hide()
    player3dealtCardsFrameSplitH1:Hide()
    player3dealtCardsFrameSplitH2:Hide()
    player3PreloadBetButton:Hide()
    player3PreloadEditBoxMainBet:Hide()
    player3PreloadEditBoxPPBet:Hide()
    player3PreloadEditBox213Bet:Hide()
    playerFrame.leaveSeat3Button:Hide()
    playerFrame.player3HitButton:Hide()
    playerFrame.player3StandButton:Hide()
    playerFrame.player3DoubleButton:Hide()
    playerFrame.player3SplitButton:Hide()
    playerFrame.player3DealNowButton:Hide()
    playerFrame.player3InsuranceYesButton:Hide()
    playerFrame.player3InsuranceNoButton:Hide()
    player3ConfirmMainBetButton:Hide()
    player3ConfirmPPBetButton:Hide()
    player3Confirm213BetButton:Hide()
    player3MainBetEditBox:Hide()
    player3PPBetEditBox:Hide()
    player3213BetEditBox:Hide()
    playerFrame.player3MainBetTitle:Hide()
    playerFrame.player3PPBetTitle:Hide()
    playerFrame.player3213BetTitle:Hide()
    playerFrame.player3InsuranceTitle:Hide()
    playerFrame.player3InsuranceSubtitle:Hide()
    menuFrame.cardsButton:Disable()
    playerFrame.historyButton:Disable()
    menuFrame.preloadButton:Disable()
    playerFrame.cashDeskButton:Disable()
    playerFrame.takeSeat3Button:Show()
    if playerFrame.player1Name:GetText() == "Seat Empty" then    
        playerFrame.takeSeat1Button:Enable()
    end
    if playerFrame.player2Name:GetText() == "Seat Empty" then  
        playerFrame.takeSeat2Button:Enable()
    end
    if playerFrame.player4Name:GetText() == "Seat Empty" then 
        playerFrame.takeSeat4Button:Enable()
    end
    if playerFrame.player5Name:GetText() == "Seat Empty" then
        playerFrame.takeSeat5Button:Enable()
    end
    bankrollFrame.player3TotalBankrollTableDisplay:Hide()
    bankrollFrame.BaseTextDisplay:Show()
    cashDeskFrame.player3TotalBankroll:Hide()
    historyFrame:Hide()
    preloadFrame:Hide()
    historyFrame.player3totalWageredAmount:Hide()
    historyFrame.player3totalWonAmount:Hide()
    historyFrame.player3totalLostAmount:Hide()
    historyFrame.player3ProfitAmount:Hide()
    seatFrame:Hide()
    seatFrame.seat3:Hide()
end)
playerFrame.player3InsuranceYesButton:SetScript("OnClick", function()

    player3MainBet = tonumber(player3MainBetEditBox:GetText())
    player3InsuranceValue = player3MainBet / 2
    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3currentBankroll - player3InsuranceValue < 0 then
        print("You do not have enough gold in your bankroll to take insurance. Please visit the Cash Desk.")
    else
        player3InsuranceYesIcon:Show()
        playerFrame.player3InsuranceYesButton:Disable()
        playerFrame.player3InsuranceNoButton:Disable()
 

        if player3MainBet then
            SendChatMessage("[P3] YES to Insurance - adding " .. player3InsuranceValue .. "G", "RAID")         
            playerFrame.player3InsuranceBetAmount:SetText(player3InsuranceValue .. " G")
        end

        if playerBankingInfo[unitName3] then
            local bankingInfo = playerBankingInfo[unitName3]
            player3totalBetAmount = bankingInfo.totalWagered + tonumber(player3InsuranceValue)
            player3TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(player3InsuranceValue)
        else
            player3totalBetAmount = player3totalBetAmount + tonumber(player3InsuranceValue)
            player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(player3InsuranceValue)
        end

        historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")
        bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
        cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
    end
end)
playerFrame.player3InsuranceNoButton:SetScript("OnClick", function()
    player3InsuranceNoIcon:Show()
    playerFrame.player3InsuranceYesButton:Disable()
    playerFrame.player3InsuranceNoButton:Disable()
    SendChatMessage("[P3] NO to Insurance", "RAID")
end)
playerFrame.player3HitButton:SetScript("OnClick", function()
    -- Handle the "hit" button action
    SendChatMessage("[P3] Hit", "RAID")
    playerFrame.player3HitButton:Disable()
    playerFrame.player3StandButton:Disable()
    playerFrame.player3DoubleButton:Disable()
    playerFrame.player3SplitButton:Disable()
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player3InsuranceYesButton:IsEnabled() and playerFrame.player3InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P3] NO to Insurance", "RAID")
        playerFrame.player3InsuranceYesButton:Disable()
        playerFrame.player3InsuranceNoButton:Disable()
        player3InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[34])
    player3DoubleToggle = true
    timerReset()
end)
playerFrame.player3HitButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P3] (H1) Hit", "RAID")
    playerFrame.player3HitButtonSplitH1:Disable()
    playerFrame.player3StandButtonSplitH1:Disable()
    playerFrame.player3DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[34])
    player3DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player3HitButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P3] (H2) Hit", "RAID")
    playerFrame.player3HitButtonSplitH2:Disable()
    playerFrame.player3StandButtonSplitH2:Disable()
    playerFrame.player3DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[34])
    player3DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player3StandButton:SetScript("OnClick", function()
    -- Handle the "stand" button action
    SendChatMessage("[P3] Stand", "RAID")
    playerFrame.player3HitButton:Disable()
    playerFrame.player3StandButton:Disable()
    playerFrame.player3DoubleButton:Disable()
    playerFrame.player3SplitButton:Disable()
    timerFrame.player3TimerText:SetText("")
    timerFrame.player3TimerText:Hide()
    if playerFrame.player3CardTotalText:GetText() == "1 or 11" then
        playerFrame.player3CardTotalText:SetText("11")
    elseif playerFrame.player3CardTotalText:GetText() == "2 or 12" then
        playerFrame.player3CardTotalText:SetText("12")
    elseif playerFrame.player3CardTotalText:GetText() == "3 or 13" then
        playerFrame.player3CardTotalText:SetText("13")
    elseif playerFrame.player3CardTotalText:GetText() == "4 or 14" then
        playerFrame.player3CardTotalText:SetText("14")
    elseif playerFrame.player3CardTotalText:GetText() == "5 or 15" then
        playerFrame.player3CardTotalText:SetText("15")
    elseif playerFrame.player3CardTotalText:GetText() == "6 or 16" then
        playerFrame.player3CardTotalText:SetText("16")
    elseif playerFrame.player3CardTotalText:GetText() == "7 or 17" then
        playerFrame.player3CardTotalText:SetText("17")
    elseif playerFrame.player3CardTotalText:GetText() == "8 or 18" then
        playerFrame.player3CardTotalText:SetText("18")
    elseif playerFrame.player3CardTotalText:GetText() == "9 or 19" then
        playerFrame.player3CardTotalText:SetText("19")
    elseif playerFrame.player3CardTotalText:GetText() == "10 or 20" then
        playerFrame.player3CardTotalText:SetText("20")
    end
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player3InsuranceYesButton:IsEnabled() and playerFrame.player3InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P3] NO to Insurance", "RAID")
        playerFrame.player3InsuranceYesButton:Disable()
        playerFrame.player3InsuranceNoButton:Disable()
        player3InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[35])
    player3DoubleToggle = true
    timerReset()
end)
playerFrame.player3StandButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P3] (H1) Stand", "RAID")
    playerFrame.player3HitButtonSplitH1:Disable()
    playerFrame.player3StandButtonSplitH1:Disable()
    playerFrame.player3DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[35])
    player3DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player3StandButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P3] (H2) Stand", "RAID")
    playerFrame.player3HitButtonSplitH2:Disable()
    playerFrame.player3StandButtonSplitH2:Disable()
    playerFrame.player3DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[35])
    player3DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player3DoubleButton:SetScript("OnClick", function()

    player3MainBet = tonumber(player3MainBetEditBox:GetText())
    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3currentBankroll - player3MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
        local betDoubleAmount3 = 0
        betAmount3 = tonumber(player3MainBetEditBox:GetText()) -- Get the entered bet amount
        if betAmount3 then
            betDoubleAmount3 = betAmount3 * 2
            SendChatMessage("[P3] Double my bet to " ..betDoubleAmount3.. "G", "RAID")
            player3MainBetEditBox:SetText(betDoubleAmount3)
            player3MainBetAmount:SetText(betDoubleAmount3)
            playerFrame.player3HitButton:Disable()
            playerFrame.player3StandButton:Disable()
            playerFrame.player3DoubleButton:Disable() 
            timerFrame.player3TimerText:SetText("")
            timerFrame.player3TimerText:Hide()
            countdownDuration = 30

            if playerBankingInfo[unitName3] then
                local bankingInfo = playerBankingInfo[unitName3]
                player3totalBetAmount = bankingInfo.totalWagered + tonumber(betAmount3)
                player3TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmount3)
            else
                player3totalBetAmount = player3totalBetAmount + tonumber(betAmount3)
                player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(betAmount3)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")

        end
        if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player3InsuranceYesButton:IsEnabled() and playerFrame.player3InsuranceNoButton:IsEnabled() then
            SendChatMessage("[P3] NO to Insurance", "RAID")
            playerFrame.player3InsuranceYesButton:Disable()
            playerFrame.player3InsuranceNoButton:Disable()
            player3InsuranceNoIcon:Show()
        end
        PlaySoundFile(soundFilePaths[36])
        player3DoubleToggle = true
        timerReset()

    end
end)
playerFrame.player3DoubleButtonSplitH1:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player3SplitH1MainBet = tonumber(player3SplitH1EditBox:GetText())
    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3currentBankroll - player3SplitH1MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
    
        local betDoubleAmountSplitH1 = 0
        betAmountSplitH1 = tonumber(string.match(player3SplitH1BetAmount:GetText(), "%d+"))
        if betAmountSplitH1 then
            betDoubleAmountSplitH1 = betAmountSplitH1 * 2
            SendChatMessage("[P3] (H1) Double my bet to " ..betDoubleAmountSplitH1.. "G", "RAID")
            player3SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            playerFrame.player3HitButtonSplitH1:Disable()
            playerFrame.player3StandButtonSplitH1:Disable()
            playerFrame.player3DoubleButtonSplitH1:Disable()
            player3DoubleHand1Toggle = true
            timerReset()

            player3SplitH1EditBox:SetText(betDoubleAmountSplitH1)

            if playerBankingInfo[unitName3] then
                print("betAmountSplitH1 = " .. betAmountSplitH1)
                print("player3TotalBankrollAmount (Before) = " .. player3TotalBankrollAmount)
                local bankingInfo = playerBankingInfo[unitName3]
                player3totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH1)
                player3TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH1)
                print("player3TotalBankrollAmount (After) = " .. player3TotalBankrollAmount)
            else
                player3totalBetAmount = player3totalBetAmount + tonumber(betAmountSplitH1)
                player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(betAmountSplitH1)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")

        end
    end
end)
playerFrame.player3DoubleButtonSplitH2:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player3SplitH2MainBet = tonumber(player3SplitH2EditBox:GetText())
    player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

    if player3currentBankroll - player3SplitH2MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else

        local betDoubleAmountSplitH2 = 0
        betAmountSplitH2 = tonumber(string.match(player3SplitH2BetAmount:GetText(), "%d+"))
        if betAmountSplitH2 then
            betDoubleAmountSplitH2 = betAmountSplitH2 * 2
            SendChatMessage("[P3] (H2) Double my bet to " ..betDoubleAmountSplitH2.. "G", "RAID")
            player3SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            playerFrame.player3HitButtonSplitH2:Disable()
            playerFrame.player3StandButtonSplitH2:Disable()
            playerFrame.player3DoubleButtonSplitH2:Disable()
            player3DoubleHand2Toggle = true
            timerReset()

            player3SplitH2EditBox:SetText(betDoubleAmountSplitH2)

            if playerBankingInfo[unitName3] then
                local bankingInfo = playerBankingInfo[unitName3]
                player3totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
                player3TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
            else
                player3totalBetAmount = player3totalBetAmount + tonumber(betAmountSplitH2)
                player3TotalBankrollAmount = player3TotalBankrollAmount - tonumber(betAmountSplitH2)
            end

            bankrollFrame.player3TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            cashDeskFrame.player3TotalBankroll:SetText("Total Bankroll: " .. player3TotalBankrollAmount .. " G")
            historyFrame.player3totalWageredAmount:SetText(player3totalBetAmount .. " G")

        end
    end
end)
playerFrame.player3SplitButton:SetScript("OnClick", function()
    if playerFrame.player3HitButton:IsEnabled() then
        PlaySoundFile(soundFilePaths[37])
        player3MainBet = tonumber(player3MainBetEditBox:GetText())
        player3currentBankroll = tonumber(string.match(bankrollFrame.player3TotalBankrollTableDisplay:GetText(), "%d+"))

        if playerFrame.player3HitButton:IsShown() then
            if player3currentBankroll - player3MainBet < 0 then
                print("You do not have enough gold in your bankroll to split your hand. Please visit the Cash Desk.")
            else

                SendChatMessage("[P3] Split", "RAID")
                playerFrame.player3HitButton:Hide()
                playerFrame.player3StandButton:Hide()
                playerFrame.player3DoubleButton:Hide()
                playerFrame.player3SplitButton:Hide()
                playerFrame.player3InsuranceYesButton:Hide()
                playerFrame.player3InsuranceNoButton:Hide()
                playerFrame.player3InsuranceTitle:Hide()
                playerFrame.player3InsuranceSubtitle:Hide()
                player3ConfirmMainBetButton:Hide()
                player3MainBetEditBox:Hide()
                playerFrame.player3MainBetTitle:Hide()
                

                playerFrame.player3SplitH1Title:Show()
                playerFrame.player3SplitH2Title:Show()
                player3SplitH1EditBox:Show()
                player3SplitH2EditBox:Show()
                playerFrame.player3HitButtonSplitH1:Show()
                playerFrame.player3StandButtonSplitH1:Show()
                playerFrame.player3DoubleButtonSplitH1:Show()
                playerFrame.player3HitButtonSplitH2:Show()
                playerFrame.player3StandButtonSplitH2:Show()
                playerFrame.player3DoubleButtonSplitH2:Show()

                betAmount3 = tonumber(player3MainBetEditBox:GetText())
                if betAmount3 then
                    player3SplitH1EditBox:SetText(betAmount3)
                    player3SplitH2EditBox:SetText(betAmount3)
                end

                if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player3InsuranceYesButton:IsEnabled() and playerFrame.player3InsuranceNoButton:IsEnabled() then
                    SendChatMessage("[P3] NO to Insurance", "RAID")
                    playerFrame.player3InsuranceYesButton:Disable()
                    playerFrame.player3InsuranceNoButton:Disable()
                    player3InsuranceNoIcon:Show()
                end

                timerReset()
            end
        else
            print("You must wait until its your turn.")
        end
    else
        print("You must wait until its your turn.")
    end  
end)
playerFrame.player3DealNowButton:SetScript("OnClick", function()
    SendChatMessage("{moon} " .. playerName .. " has indicated they are ready.", "RAID")
    -- Player 3 bet buttons disabled
    player3ConfirmMainBetButton:Disable()
    player3ConfirmPPBetButton:Disable()
    player3Confirm213BetButton:Disable()
    player3PreloadBetButton:Disable()
    playerFrame.player3DealNowButton:Disable()
end)





-- >> PLAYER 4 <<
-- >> PLAYER 4 <<
-- >> PLAYER 4 <<

playerFrame.takeSeat4Button:SetScript("OnClick", function(self, button, down)
    SendChatMessage("{circle} " .. playerName .. " has sat down in Seat 4.", "RAID")
    tableSpectator = false
    if playerBankingInfo[playerName] then
        local bankingInfo = playerBankingInfo[playerName]
        player4totalBetAmount = bankingInfo.totalWagered
        player4totalWin = bankingInfo.totalWon
        player4totalLoss = bankingInfo.totalLost
        player4totalProfit = bankingInfo.totalProfit
        player4TotalBankrollAmount = bankingInfo.bankrollTable
    else
    end
    tipDealerEditBox:Enable()
    playerFrame.reportButton:Enable()
    playerFrame.tipButton:Enable()
    player4PreloadBetButton:Show()
    player4PreloadEditBoxMainBet:Show()
    player4PreloadEditBoxPPBet:Show()
    player4PreloadEditBox213Bet:Show()
    playerFrame.leaveSeat4Button:Show()
    playerFrame.player4HitButton:Show()
    playerFrame.player4StandButton:Show()
    playerFrame.player4DoubleButton:Show()
    playerFrame.player4SplitButton:Show()
    playerFrame.player4DealNowButton:Show()
    player4ConfirmMainBetButton:Show()
    player4ConfirmPPBetButton:Show()
    player4Confirm213BetButton:Show()
    player4MainBetEditBox:Show()
    player4PPBetEditBox:Show()
    player4213BetEditBox:Show()
    playerFrame.player4MainBetTitle:Show()
    playerFrame.player4PPBetTitle:Show()
    playerFrame.player4213BetTitle:Show()
    --menuFrame.cardsButton:Enable()
    playerFrame.historyButton:Enable()
    menuFrame.preloadButton:Enable()
    playerFrame.cashDeskButton:Enable()
    playerFrame.takeSeat1Button:Disable()
    playerFrame.takeSeat2Button:Disable()
    playerFrame.takeSeat3Button:Disable()
    playerFrame.takeSeat4Button:Hide()
    playerFrame.takeSeat5Button:Disable()
    cashDeskFrame.player4TotalBankroll:Show()
    bankrollFrame.player4TotalBankrollTableDisplay:Show()
    bankrollFrame.BaseTextDisplay:Hide()
    historyFrame.player4totalWageredAmount:Show()
    historyFrame.player4totalWonAmount:Show()
    historyFrame.player4totalLostAmount:Show()
    historyFrame.player4ProfitAmount:Show()
    seatFrame:Show()
    seatFrame.seat4:SetAlpha(1)
    seatFrame.seat4:Show()
    ResetSeatFrame4()
    StartSeat4FadeOut()
end)
playerFrame.leaveSeat4Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = true
    SendChatMessage("{circle} " .. playerName .. " has left Seat 4.", "RAID")
    local wageredString = historyFrame.player2totalWageredAmount:GetText()
    local wonString = historyFrame.player2totalWonAmount:GetText()
    local lostString = historyFrame.player2totalLostAmount:GetText()
    local profitString = historyFrame.player2ProfitAmount:GetText()
    local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()

    local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
    local wonAmount = tonumber(string.match(wonString, "(%d+)"))
    local lostAmount = tonumber(string.match(lostString, "(%d+)"))
    local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
    local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

    -- Store banking information for the leaving player
    if wageredAmount then
        playerBankingInfo[playerName] = {
            totalWagered = wageredAmount,
            totalWon = wonAmount,
            totalLost = lostAmount,
            totalProfit = profitAmount,
            bankrollTable = bankrollAmount,
            bankrollCashDesk = bankrollAmount
        }
    else
        print("wageredAmount == nil")
    end
    tipDealerEditBox:Disable()
    playerFrame.reportButton:Disable()
    playerFrame.tipButton:Disable()
    player4dealtCardsFrame:Hide()
    player4dealtCardsFrameSplitH1:Hide()
    player4dealtCardsFrameSplitH2:Hide()
    player4PreloadBetButton:Hide()
    player4PreloadEditBoxMainBet:Hide()
    player4PreloadEditBoxPPBet:Hide()
    player4PreloadEditBox213Bet:Hide()
    playerFrame.leaveSeat4Button:Hide()
    playerFrame.player4HitButton:Hide()
    playerFrame.player4StandButton:Hide()
    playerFrame.player4DoubleButton:Hide()
    playerFrame.player4SplitButton:Hide()
    playerFrame.player4DealNowButton:Hide()
    playerFrame.player4InsuranceYesButton:Hide()
    playerFrame.player4InsuranceNoButton:Hide()
    player4PreloadBetButton:Hide()
    player4ConfirmMainBetButton:Hide()
    player4ConfirmPPBetButton:Hide()
    player4Confirm213BetButton:Hide()
    player4MainBetEditBox:Hide()
    player4PPBetEditBox:Hide()
    player4213BetEditBox:Hide()
    playerFrame.player4MainBetTitle:Hide()
    playerFrame.player4PPBetTitle:Hide()
    playerFrame.player4213BetTitle:Hide()
    playerFrame.player4InsuranceTitle:Hide()
    playerFrame.player4InsuranceSubtitle:Hide()
    menuFrame.cardsButton:Disable()
    playerFrame.historyButton:Disable()
    menuFrame.preloadButton:Disable()
    playerFrame.cashDeskButton:Disable()
    playerFrame.takeSeat4Button:Show()
    if playerFrame.player1Name:GetText() == "Seat Empty" then    
        playerFrame.takeSeat1Button:Enable()
    end
    if playerFrame.player2Name:GetText() == "Seat Empty" then  
        playerFrame.takeSeat2Button:Enable()
    end
    if playerFrame.player3Name:GetText() == "Seat Empty" then 
        playerFrame.takeSeat3Button:Enable()
    end
    if playerFrame.player5Name:GetText() == "Seat Empty" then
        playerFrame.takeSeat5Button:Enable()
    end
    bankrollFrame.player4TotalBankrollTableDisplay:Hide()
    bankrollFrame.BaseTextDisplay:Show()
    cashDeskFrame.player4TotalBankroll:Hide()
    historyFrame:Hide()
    preloadFrame:Hide()
    historyFrame.player4totalWageredAmount:Hide()
    historyFrame.player4totalWonAmount:Hide()
    historyFrame.player4totalLostAmount:Hide()
    historyFrame.player4ProfitAmount:Hide()
    seatFrame:Hide()
    seatFrame.seat4:Hide()
end)
playerFrame.player4InsuranceYesButton:SetScript("OnClick", function()

    player4MainBet = tonumber(player4MainBetEditBox:GetText())
    player4InsuranceValue = player4MainBet / 2
    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4currentBankroll - player4InsuranceValue < 0 then
        print("You do not have enough gold in your bankroll to take insurance. Please visit the Cash Desk.")
    else
        player4InsuranceYesIcon:Show()
        playerFrame.player4InsuranceYesButton:Disable()
        playerFrame.player4InsuranceNoButton:Disable()

        if player4MainBet then
            SendChatMessage("[P4] YES to Insurance - adding " .. player4InsuranceValue .. "G", "RAID")         
            playerFrame.player4InsuranceBetAmount:SetText(player4InsuranceValue .. " G")
        end

        if playerBankingInfo[unitName4] then
            local bankingInfo = playerBankingInfo[unitName4]
            player4totalBetAmount = bankingInfo.totalWagered + tonumber(player4InsuranceValue)
            player4TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(player4InsuranceValue)
        else
            player4totalBetAmount = player4totalBetAmount + tonumber(player4InsuranceValue)
            player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(player4InsuranceValue)
        end

        historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")
        bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
        cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
    end
end)
playerFrame.player4InsuranceNoButton:SetScript("OnClick", function()
    player4InsuranceNoIcon:Show()
    playerFrame.player4InsuranceYesButton:Disable()
    playerFrame.player4InsuranceNoButton:Disable()
    SendChatMessage("[P4] NO to Insurance", "RAID")
end)
playerFrame.player4HitButton:SetScript("OnClick", function()
    -- Handle the "hit" button action
    SendChatMessage("[P4] Hit", "RAID")
    playerFrame.player4HitButton:Disable()
    playerFrame.player4StandButton:Disable()
    playerFrame.player4DoubleButton:Disable()
    playerFrame.player4SplitButton:Disable()
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player4InsuranceYesButton:IsEnabled() and playerFrame.player4InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P4] NO to Insurance", "RAID")
        playerFrame.player4InsuranceYesButton:Disable()
        playerFrame.player4InsuranceNoButton:Disable()
        player4InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[34])
    player4DoubleToggle = true
    timerReset()
end)
playerFrame.player4HitButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P4] (H1) Hit", "RAID")
    playerFrame.player4HitButtonSplitH1:Disable()
    playerFrame.player4StandButtonSplitH1:Disable()
    playerFrame.player4DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[34])
    player4DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player4HitButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P4] (H2) Hit", "RAID")
    playerFrame.player4HitButtonSplitH2:Disable()
    playerFrame.player4StandButtonSplitH2:Disable()
    playerFrame.player4DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[34])
    player4DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player4StandButton:SetScript("OnClick", function()
    -- Handle the "stand" button action
    SendChatMessage("[P4] Stand", "RAID")
    playerFrame.player4HitButton:Disable()
    playerFrame.player4StandButton:Disable()
    playerFrame.player4DoubleButton:Disable()
    playerFrame.player4SplitButton:Disable()
    timerFrame.player4TimerText:SetText("")
    timerFrame.player4TimerText:Hide()
    if playerFrame.player4CardTotalText:GetText() == "1 or 11" then
        playerFrame.player4CardTotalText:SetText("11")
    elseif playerFrame.player4CardTotalText:GetText() == "2 or 12" then
        playerFrame.player4CardTotalText:SetText("12")
    elseif playerFrame.player4CardTotalText:GetText() == "3 or 13" then
        playerFrame.player4CardTotalText:SetText("13")
    elseif playerFrame.player4CardTotalText:GetText() == "4 or 14" then
        playerFrame.player4CardTotalText:SetText("14")
    elseif playerFrame.player4CardTotalText:GetText() == "5 or 15" then
        playerFrame.player4CardTotalText:SetText("15")
    elseif playerFrame.player4CardTotalText:GetText() == "6 or 16" then
        playerFrame.player4CardTotalText:SetText("16")
    elseif playerFrame.player4CardTotalText:GetText() == "7 or 17" then
        playerFrame.player4CardTotalText:SetText("17")
    elseif playerFrame.player4CardTotalText:GetText() == "8 or 18" then
        playerFrame.player4CardTotalText:SetText("18")
    elseif playerFrame.player4CardTotalText:GetText() == "9 or 19" then
        playerFrame.player4CardTotalText:SetText("19")
    elseif playerFrame.player4CardTotalText:GetText() == "10 or 20" then
        playerFrame.player4CardTotalText:SetText("20")
    end
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player4InsuranceYesButton:IsEnabled() and playerFrame.player4InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P4] NO to Insurance", "RAID")
        playerFrame.player4InsuranceYesButton:Disable()
        playerFrame.player4InsuranceNoButton:Disable()
        player4InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[35])
    player4DoubleToggle = true
    timerReset()
end)
playerFrame.player4StandButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P4] (H1) Stand", "RAID")
    playerFrame.player4HitButtonSplitH1:Disable()
    playerFrame.player4StandButtonSplitH1:Disable()
    playerFrame.player4DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[35])
    player4DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player4StandButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P4] (H2) Stand", "RAID")
    playerFrame.player4HitButtonSplitH2:Disable()
    playerFrame.player4StandButtonSplitH2:Disable()
    playerFrame.player4DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[35])
    player4DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player4DoubleButton:SetScript("OnClick", function()

    player4MainBet = tonumber(player4MainBetEditBox:GetText())
    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4currentBankroll - player4MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
        local betDoubleAmount4 = 0
        betAmount4 = tonumber(player4MainBetEditBox:GetText()) -- Get the entered bet amount
        if betAmount4 then
            betDoubleAmount4 = betAmount4 * 2
            SendChatMessage("[P4] Double my bet to " ..betDoubleAmount4.. "G", "RAID")
            player4MainBetEditBox:SetText(betDoubleAmount4)
            player4MainBetAmount:SetText(betDoubleAmount4)
            playerFrame.player4HitButton:Disable()
            playerFrame.player4StandButton:Disable()
            playerFrame.player4DoubleButton:Disable() 
            timerFrame.player4TimerText:SetText("")
            timerFrame.player4TimerText:Hide()
            countdownDuration = 30

            if playerBankingInfo[unitName4] then
                local bankingInfo = playerBankingInfo[unitName4]
                player4totalBetAmount = bankingInfo.totalWagered + tonumber(betAmount4)
                player4TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmount4)
            else
                player4totalBetAmount = player4totalBetAmount + tonumber(betAmount4)
                player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(betAmount4)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")

        end
        if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player4InsuranceYesButton:IsEnabled() and playerFrame.player4InsuranceNoButton:IsEnabled() then
            SendChatMessage("[P4] NO to Insurance", "RAID")
            playerFrame.player4InsuranceYesButton:Disable()
            playerFrame.player4InsuranceNoButton:Disable()
            player4InsuranceNoIcon:Show()
        end
        PlaySoundFile(soundFilePaths[36])
        player4DoubleToggle = true
        timerReset()

    end
end)
playerFrame.player4DoubleButtonSplitH1:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player4SplitH1MainBet = tonumber(player4SplitH1EditBox:GetText())
    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4currentBankroll - player4SplitH1MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
    
        local betDoubleAmountSplitH1 = 0
        betAmountSplitH1 = tonumber(string.match(player4SplitH1BetAmount:GetText(), "%d+"))
        if betAmountSplitH1 then
            betDoubleAmountSplitH1 = betAmountSplitH1 * 2
            SendChatMessage("[P4] (H1) Double my bet to " ..betDoubleAmountSplitH1.. "G", "RAID")
            player4SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            playerFrame.player4HitButtonSplitH1:Disable()
            playerFrame.player4StandButtonSplitH1:Disable()
            playerFrame.player4DoubleButtonSplitH1:Disable()
            player4DoubleHand1Toggle = true
            timerReset()

            player4SplitH1EditBox:SetText(betDoubleAmountSplitH1)

            if playerBankingInfo[unitName4] then
                local bankingInfo = playerBankingInfo[unitName4]
                player4totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH1)
                player4TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH1)
            else
                player4totalBetAmount = player4totalBetAmount + tonumber(betAmountSplitH1)
                player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(betAmountSplitH1)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")

        end
    end
end)
playerFrame.player4DoubleButtonSplitH2:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player4SplitH2MainBet = tonumber(player4SplitH2EditBox:GetText())
    player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

    if player4currentBankroll - player4SplitH2MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else

        local betDoubleAmountSplitH2 = 0
        betAmountSplitH2 = tonumber(string.match(player4SplitH2BetAmount:GetText(), "%d+"))
        if betAmountSplitH2 then
            betDoubleAmountSplitH2 = betAmountSplitH2 * 2
            SendChatMessage("[P4] (H2) Double my bet to " ..betDoubleAmountSplitH2.. "G", "RAID")
            player4SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            playerFrame.player4HitButtonSplitH2:Disable()
            playerFrame.player4StandButtonSplitH2:Disable()
            playerFrame.player4DoubleButtonSplitH2:Disable()
            player4DoubleHand2Toggle = true
            timerReset()

            player4SplitH2EditBox:SetText(betDoubleAmountSplitH2)

            if playerBankingInfo[unitName4] then
                local bankingInfo = playerBankingInfo[unitName4]
                player4totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
                player4TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
            else
                player4totalBetAmount = player4totalBetAmount + tonumber(betAmountSplitH2)
                player4TotalBankrollAmount = player4TotalBankrollAmount - tonumber(betAmountSplitH2)
            end

            bankrollFrame.player4TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            cashDeskFrame.player4TotalBankroll:SetText("Total Bankroll: " .. player4TotalBankrollAmount .. " G")
            historyFrame.player4totalWageredAmount:SetText(player4totalBetAmount .. " G")

        end
    end
end)
playerFrame.player4SplitButton:SetScript("OnClick", function()
    if playerFrame.player4HitButton:IsEnabled() then
        PlaySoundFile(soundFilePaths[37])
        player4MainBet = tonumber(player4MainBetEditBox:GetText())
        player4currentBankroll = tonumber(string.match(bankrollFrame.player4TotalBankrollTableDisplay:GetText(), "%d+"))

        if playerFrame.player4HitButton:IsShown() then
            if player4currentBankroll - player4MainBet < 0 then
                print("You do not have enough gold in your bankroll to split your hand. Please visit the Cash Desk.")
            else

                SendChatMessage("[P4] Split", "RAID")
                playerFrame.player4HitButton:Hide()
                playerFrame.player4StandButton:Hide()
                playerFrame.player4DoubleButton:Hide()
                playerFrame.player4SplitButton:Hide()
                playerFrame.player4InsuranceYesButton:Hide()
                playerFrame.player4InsuranceNoButton:Hide()
                playerFrame.player4InsuranceTitle:Hide()
                playerFrame.player4InsuranceSubtitle:Hide()
                player4ConfirmMainBetButton:Hide()
                player4MainBetEditBox:Hide()
                playerFrame.player4MainBetTitle:Hide()
                

                playerFrame.player4SplitH1Title:Show()
                playerFrame.player4SplitH2Title:Show()
                player4SplitH1EditBox:Show()
                player4SplitH2EditBox:Show()
                playerFrame.player4HitButtonSplitH1:Show()
                playerFrame.player4StandButtonSplitH1:Show()
                playerFrame.player4DoubleButtonSplitH1:Show()
                playerFrame.player4HitButtonSplitH2:Show()
                playerFrame.player4StandButtonSplitH2:Show()
                playerFrame.player4DoubleButtonSplitH2:Show()

                betAmount4 = tonumber(player4MainBetEditBox:GetText())
                if betAmount4 then
                    player4SplitH1EditBox:SetText(betAmount4)
                    player4SplitH2EditBox:SetText(betAmount4)
                end

                if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player4InsuranceYesButton:IsEnabled() and playerFrame.player4InsuranceNoButton:IsEnabled() then
                    SendChatMessage("[P4] NO to Insurance", "RAID")
                    playerFrame.player4InsuranceYesButton:Disable()
                    playerFrame.player4InsuranceNoButton:Disable()
                    player4InsuranceNoIcon:Show()
                end

                timerReset()
            end
        else
            print("You must wait until its your turn.")
        end
    else
        print("You must wait until its your turn.")
    end 
end)
playerFrame.player4DealNowButton:SetScript("OnClick", function()
    SendChatMessage("{moon} " .. playerName .. " has indicated they are ready.", "RAID")
    -- Player 4 bet buttons disabled
    player4ConfirmMainBetButton:Disable()
    player4ConfirmPPBetButton:Disable()
    player4Confirm213BetButton:Disable()
    player4PreloadBetButton:Disable()
    playerFrame.player4DealNowButton:Disable()
end)





-- >> PLAYER 5 <<
-- >> PLAYER 5 <<
-- >> PLAYER 5 <<

playerFrame.takeSeat5Button:SetScript("OnClick", function(self, button, down)
    SendChatMessage("{circle} " .. playerName .. " has sat down in Seat 5.", "RAID")
    tableSpectator = false
    if playerBankingInfo[playerName] then
        local bankingInfo = playerBankingInfo[playerName]
        player5totalBetAmount = bankingInfo.totalWagered
        player5totalWin = bankingInfo.totalWon
        player5totalLoss = bankingInfo.totalLost
        player5totalProfit = bankingInfo.totalProfit
        player5TotalBankrollAmount = bankingInfo.bankrollTable
    else
    end
    tipDealerEditBox:Enable()
    playerFrame.reportButton:Enable()
    playerFrame.tipButton:Enable()
    player5PreloadBetButton:Show()
    player5PreloadEditBoxMainBet:Show()
    player5PreloadEditBoxPPBet:Show()
    player5PreloadEditBox213Bet:Show()
    playerFrame.leaveSeat5Button:Show()
    playerFrame.player5HitButton:Show()
    playerFrame.player5StandButton:Show()
    playerFrame.player5DoubleButton:Show()
    playerFrame.player5SplitButton:Show()
    playerFrame.player5DealNowButton:Show()
    player5ConfirmMainBetButton:Show()
    player5ConfirmPPBetButton:Show()
    player5Confirm213BetButton:Show()
    player5MainBetEditBox:Show()
    player5PPBetEditBox:Show()
    player5213BetEditBox:Show()
    playerFrame.player5MainBetTitle:Show()
    playerFrame.player5PPBetTitle:Show()
    playerFrame.player5213BetTitle:Show()
    --menuFrame.cardsButton:Enable()
    playerFrame.historyButton:Enable()
    menuFrame.preloadButton:Enable()
    playerFrame.cashDeskButton:Enable()
    playerFrame.takeSeat1Button:Disable()
    playerFrame.takeSeat2Button:Disable()
    playerFrame.takeSeat3Button:Disable()
    playerFrame.takeSeat4Button:Disable()
    playerFrame.takeSeat5Button:Hide()
    cashDeskFrame.player5TotalBankroll:Show()
    bankrollFrame.player5TotalBankrollTableDisplay:Show()
    bankrollFrame.BaseTextDisplay:Hide()
    historyFrame.player5totalWageredAmount:Show()
    historyFrame.player5totalWonAmount:Show()
    historyFrame.player5totalLostAmount:Show()
    historyFrame.player5ProfitAmount:Show()
    seatFrame:Show()
    seatFrame.seat5:SetAlpha(1)
    seatFrame.seat5:Show()
    ResetSeatFrame5()
    StartSeat5FadeOut()
end)
playerFrame.leaveSeat5Button:SetScript("OnClick", function(self, button, down)
    tableSpectator = true
    SendChatMessage("{circle} " .. playerName .. " has left Seat 5.", "RAID")
    local wageredString = historyFrame.player2totalWageredAmount:GetText()
    local wonString = historyFrame.player2totalWonAmount:GetText()
    local lostString = historyFrame.player2totalLostAmount:GetText()
    local profitString = historyFrame.player2ProfitAmount:GetText()
    local bankrollString = bankrollFrame.player2TotalBankrollTableDisplay:GetText()

    local wageredAmount = tonumber(string.match(wageredString, "(%d+)"))
    local wonAmount = tonumber(string.match(wonString, "(%d+)"))
    local lostAmount = tonumber(string.match(lostString, "(%d+)"))
    local profitAmount = tonumber(string.match(profitString, "(-?%d+)"))
    local bankrollAmount = tonumber(string.match(bankrollString, "(%d+)"))

    -- Store banking information for the leaving player
    if wageredAmount then
        playerBankingInfo[playerName] = {
            totalWagered = wageredAmount,
            totalWon = wonAmount,
            totalLost = lostAmount,
            totalProfit = profitAmount,
            bankrollTable = bankrollAmount,
            bankrollCashDesk = bankrollAmount
        }
    else
        print("wageredAmount == nil")
    end
    tipDealerEditBox:Disable()
    playerFrame.reportButton:Disable()
    playerFrame.tipButton:Disable()
    player5PreloadBetButton:Hide()
    player5PreloadEditBoxMainBet:Hide()
    player5PreloadEditBoxPPBet:Hide()
    player5PreloadEditBox213Bet:Hide()
    playerFrame.leaveSeat5Button:Hide()
    playerFrame.player5HitButton:Hide()
    playerFrame.player5StandButton:Hide()
    playerFrame.player5DoubleButton:Hide()
    playerFrame.player5SplitButton:Hide()
    playerFrame.player5DealNowButton:Hide()
    playerFrame.player5InsuranceYesButton:Hide()
    playerFrame.player5InsuranceNoButton:Hide()
    player5ConfirmMainBetButton:Hide()
    player5ConfirmPPBetButton:Hide()
    player5Confirm213BetButton:Hide()
    player5MainBetEditBox:Hide()
    player5PPBetEditBox:Hide()
    player5213BetEditBox:Hide()
    playerFrame.player5MainBetTitle:Hide()
    playerFrame.player5PPBetTitle:Hide()
    playerFrame.player5213BetTitle:Hide()
    playerFrame.player5InsuranceTitle:Hide()
    playerFrame.player5InsuranceSubtitle:Hide()
    menuFrame.cardsButton:Disable()
    playerFrame.historyButton:Disable()
    menuFrame.preloadButton:Disable()
    playerFrame.cashDeskButton:Disable()
    playerFrame.takeSeat5Button:Show()
    if playerFrame.player1Name:GetText() == "Seat Empty" then    
        playerFrame.takeSeat1Button:Enable()
    end
    if playerFrame.player2Name:GetText() == "Seat Empty" then  
        playerFrame.takeSeat2Button:Enable()
    end
    if playerFrame.player3Name:GetText() == "Seat Empty" then 
        playerFrame.takeSeat3Button:Enable()
    end
    if playerFrame.player4Name:GetText() == "Seat Empty" then
        playerFrame.takeSeat4Button:Enable()
    end
    bankrollFrame.player5TotalBankrollTableDisplay:Hide()
    bankrollFrame.BaseTextDisplay:Show()
    cashDeskFrame.player5TotalBankroll:Hide()
    historyFrame:Hide()
    preloadFrame:Hide()
    player5dealtCardsFrame:Hide()
    player5dealtCardsFrameSplitH1:Hide()
    player5dealtCardsFrameSplitH2:Hide()
    historyFrame.player5totalWageredAmount:Hide()
    historyFrame.player5totalWonAmount:Hide()
    historyFrame.player5totalLostAmount:Hide()
    historyFrame.player5ProfitAmount:Hide()
    seatFrame:Hide()
    seatFrame.seat5:Hide()
end)
playerFrame.player5InsuranceYesButton:SetScript("OnClick", function()

    player5MainBet = tonumber(player5MainBetEditBox:GetText())
    player5InsuranceValue = player5MainBet / 2
    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5currentBankroll - player5InsuranceValue < 0 then
        print("You do not have enough gold in your bankroll to take insurance. Please visit the Cash Desk.")
    else
        player5InsuranceYesIcon:Show()
        playerFrame.player5InsuranceYesButton:Disable()
        playerFrame.player5InsuranceNoButton:Disable()

        if player5MainBet then
            SendChatMessage("[P5] YES to Insurance - adding " .. player5InsuranceValue .. "G", "RAID")         
            playerFrame.player5InsuranceBetAmount:SetText(player5InsuranceValue .. " G")
        end

        if playerBankingInfo[unitName5] then
            local bankingInfo = playerBankingInfo[unitName5]
            player5totalBetAmount = bankingInfo.totalWagered + tonumber(player5InsuranceValue)
            player5TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(player5InsuranceValue)
        else
            player5totalBetAmount = player5totalBetAmount + tonumber(player5InsuranceValue)
            player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(player5InsuranceValue)
        end

        historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")
        bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
        cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
    end
end)
playerFrame.player5InsuranceNoButton:SetScript("OnClick", function()
    player5InsuranceNoIcon:Show()
    playerFrame.player5InsuranceYesButton:Disable()
    playerFrame.player5InsuranceNoButton:Disable()
    SendChatMessage("[P5] NO to Insurance", "RAID")
end)
playerFrame.player5HitButton:SetScript("OnClick", function()
    -- Handle the "hit" button action
    SendChatMessage("[P5] Hit", "RAID")
    playerFrame.player5HitButton:Disable()
    playerFrame.player5StandButton:Disable()
    playerFrame.player5DoubleButton:Disable()
    playerFrame.player5SplitButton:Disable()
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player5InsuranceYesButton:IsEnabled() and playerFrame.player5InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P5] NO to Insurance", "RAID")
        playerFrame.player5InsuranceYesButton:Disable()
        playerFrame.player5InsuranceNoButton:Disable()
        player5InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[34])
    player5DoubleToggle = true
    timerReset()
end)
playerFrame.player5HitButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P5] (H1) Hit", "RAID")
    playerFrame.player5HitButtonSplitH1:Disable()
    playerFrame.player5StandButtonSplitH1:Disable()
    playerFrame.player5DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[34])
    player5DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player5HitButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P5] (H2) Hit", "RAID")
    playerFrame.player5HitButtonSplitH2:Disable()
    playerFrame.player5StandButtonSplitH2:Disable()
    playerFrame.player5DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[34])
    player5DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player5StandButton:SetScript("OnClick", function()
    -- Handle the "stand" button action
    SendChatMessage("[P5] Stand", "RAID")
    playerFrame.player5HitButton:Disable()
    playerFrame.player5StandButton:Disable()
    playerFrame.player5DoubleButton:Disable()
    playerFrame.player5SplitButton:Disable()
    timerFrame.player5TimerText:SetText("")
    timerFrame.player5TimerText:Hide()
    if playerFrame.player5CardTotalText:GetText() == "1 or 11" then
        playerFrame.player5CardTotalText:SetText("11")
    elseif playerFrame.player5CardTotalText:GetText() == "2 or 12" then
        playerFrame.player5CardTotalText:SetText("12")
    elseif playerFrame.player5CardTotalText:GetText() == "3 or 13" then
        playerFrame.player5CardTotalText:SetText("13")
    elseif playerFrame.player5CardTotalText:GetText() == "4 or 14" then
        playerFrame.player5CardTotalText:SetText("14")
    elseif playerFrame.player5CardTotalText:GetText() == "5 or 15" then
        playerFrame.player5CardTotalText:SetText("15")
    elseif playerFrame.player5CardTotalText:GetText() == "6 or 16" then
        playerFrame.player5CardTotalText:SetText("16")
    elseif playerFrame.player5CardTotalText:GetText() == "7 or 17" then
        playerFrame.player5CardTotalText:SetText("17")
    elseif playerFrame.player5CardTotalText:GetText() == "8 or 18" then
        playerFrame.player5CardTotalText:SetText("18")
    elseif playerFrame.player5CardTotalText:GetText() == "9 or 19" then
        playerFrame.player5CardTotalText:SetText("19")
    elseif playerFrame.player5CardTotalText:GetText() == "10 or 20" then
        playerFrame.player5CardTotalText:SetText("20")
    end
    if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player5InsuranceYesButton:IsEnabled() and playerFrame.player5InsuranceNoButton:IsEnabled() then
        SendChatMessage("[P5] NO to Insurance", "RAID")
        playerFrame.player5InsuranceYesButton:Disable()
        playerFrame.player5InsuranceNoButton:Disable()
        player5InsuranceNoIcon:Show()
    end
    PlaySoundFile(soundFilePaths[35])
    player5DoubleToggle = true
    timerReset()
end)
playerFrame.player5StandButtonSplitH1:SetScript("OnClick", function()
    SendChatMessage("[P5] (H1) Stand", "RAID")
    playerFrame.player5HitButtonSplitH1:Disable()
    playerFrame.player5StandButtonSplitH1:Disable()
    playerFrame.player5DoubleButtonSplitH1:Disable()
    PlaySoundFile(soundFilePaths[35])
    player5DoubleHand1Toggle = true
    timerReset()
end)
playerFrame.player5StandButtonSplitH2:SetScript("OnClick", function()
    SendChatMessage("[P5] (H2) Stand", "RAID")
    playerFrame.player5HitButtonSplitH2:Disable()
    playerFrame.player5StandButtonSplitH2:Disable()
    playerFrame.player5DoubleButtonSplitH2:Disable()
    PlaySoundFile(soundFilePaths[35])
    player5DoubleHand2Toggle = true
    timerReset()
end)
playerFrame.player5DoubleButton:SetScript("OnClick", function()

    player5MainBet = tonumber(player5MainBetEditBox:GetText())
    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5currentBankroll - player5MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
        local betDoubleAmount5 = 0
        betAmount5 = tonumber(player5MainBetEditBox:GetText()) -- Get the entered bet amount
        if betAmount5 then
            betDoubleAmount5 = betAmount5 * 2
            SendChatMessage("[P5] Double my bet to " ..betDoubleAmount5.. "G", "RAID")
            player5MainBetEditBox:SetText(betDoubleAmount5)
            player5MainBetAmount:SetText(betDoubleAmount5)
            playerFrame.player5HitButton:Disable()
            playerFrame.player5StandButton:Disable()
            playerFrame.player5DoubleButton:Disable() 
            timerFrame.player5TimerText:SetText("")
            timerFrame.player5TimerText:Hide()
            countdownDuration = 30

            if playerBankingInfo[unitName5] then
                local bankingInfo = playerBankingInfo[unitName5]
                player5totalBetAmount = bankingInfo.totalWagered + tonumber(betAmount5)
                player5TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmount5)
            else
                player5totalBetAmount = player5totalBetAmount + tonumber(betAmount5)
                player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(betAmount5)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")

        end
        if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player5InsuranceYesButton:IsEnabled() and playerFrame.player5InsuranceNoButton:IsEnabled() then
            SendChatMessage("[P5] NO to Insurance", "RAID")
            playerFrame.player5InsuranceYesButton:Disable()
            playerFrame.player5InsuranceNoButton:Disable()
            player5InsuranceNoIcon:Show()
        end
        PlaySoundFile(soundFilePaths[36])
        player5DoubleToggle = true
        timerReset()

    end
end)
playerFrame.player5DoubleButtonSplitH1:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player5SplitH1MainBet = tonumber(player5SplitH1EditBox:GetText())
    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5currentBankroll - player5SplitH1MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else
    
        local betDoubleAmountSplitH1 = 0
        betAmountSplitH1 = tonumber(string.match(player5SplitH1BetAmount:GetText(), "%d+"))
        if betAmountSplitH1 then
            betDoubleAmountSplitH1 = betAmountSplitH1 * 2
            SendChatMessage("[P5] (H1) Double my bet to " ..betDoubleAmountSplitH1.. "G", "RAID")
            player5SplitH1BetAmount:SetText(betDoubleAmountSplitH1 .. " G")
            playerFrame.player5HitButtonSplitH1:Disable()
            playerFrame.player5StandButtonSplitH1:Disable()
            playerFrame.player5DoubleButtonSplitH1:Disable()
            player5DoubleHand1Toggle = true
            timerReset()

            player5SplitH1EditBox:SetText(betDoubleAmountSplitH1)

            if playerBankingInfo[unitName5] then
                local bankingInfo = playerBankingInfo[unitName5]
                player5totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH1)
                player5TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH1)
            else
                player5totalBetAmount = player5totalBetAmount + tonumber(betAmountSplitH1)
                player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(betAmountSplitH1)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")

        end
    end
end)
playerFrame.player5DoubleButtonSplitH2:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[36])
    player5SplitH2MainBet = tonumber(player5SplitH2EditBox:GetText())
    player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

    if player5currentBankroll - player5SplitH2MainBet < 0 then
        print("You do not have enough gold in your bankroll to double your bet. Please visit the Cash Desk.")
    else

        local betDoubleAmountSplitH2 = 0
        betAmountSplitH2 = tonumber(string.match(player5SplitH2BetAmount:GetText(), "%d+"))
        if betAmountSplitH2 then
            betDoubleAmountSplitH2 = betAmountSplitH2 * 2
            SendChatMessage("[P5] (H2) Double my bet to " ..betDoubleAmountSplitH2.. "G", "RAID")
            player5SplitH2BetAmount:SetText(betDoubleAmountSplitH2 .. " G")
            playerFrame.player5HitButtonSplitH2:Disable()
            playerFrame.player5StandButtonSplitH2:Disable()
            playerFrame.player5DoubleButtonSplitH2:Disable()
            player5DoubleHand2Toggle = true
            timerReset()

            player5SplitH2EditBox:SetText(betDoubleAmountSplitH2)

            if playerBankingInfo[unitName5] then
                local bankingInfo = playerBankingInfo[unitName5]
                player5totalBetAmount = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.totalWagered = bankingInfo.totalWagered + tonumber(betAmountSplitH2)
                bankingInfo.bankrollTable = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
                player5TotalBankrollAmount = bankingInfo.bankrollTable - tonumber(betAmountSplitH2)
            else
                player5totalBetAmount = player5totalBetAmount + tonumber(betAmountSplitH2)
                player5TotalBankrollAmount = player5TotalBankrollAmount - tonumber(betAmountSplitH2)
            end

            bankrollFrame.player5TotalBankrollTableDisplay:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            cashDeskFrame.player5TotalBankroll:SetText("Total Bankroll: " .. player5TotalBankrollAmount .. " G")
            historyFrame.player5totalWageredAmount:SetText(player5totalBetAmount .. " G")

        end
    end
end)
playerFrame.player5SplitButton:SetScript("OnClick", function()
    if playerFrame.player5HitButton:IsEnabled() then
        PlaySoundFile(soundFilePaths[37])
        player5MainBet = tonumber(player5MainBetEditBox:GetText())
        player5currentBankroll = tonumber(string.match(bankrollFrame.player5TotalBankrollTableDisplay:GetText(), "%d+"))

        if playerFrame.player5HitButton:IsShown() then
            if player5currentBankroll - player5MainBet < 0 then
                print("You do not have enough gold in your bankroll to split your hand. Please visit the Cash Desk.")
            else

                SendChatMessage("[P5] Split", "RAID")
                playerFrame.player5HitButton:Hide()
                playerFrame.player5StandButton:Hide()
                playerFrame.player5DoubleButton:Hide()
                playerFrame.player5SplitButton:Hide()
                playerFrame.player5InsuranceYesButton:Hide()
                playerFrame.player5InsuranceNoButton:Hide()
                playerFrame.player5InsuranceTitle:Hide()
                playerFrame.player5InsuranceSubtitle:Hide()
                player5ConfirmMainBetButton:Hide()
                player5MainBetEditBox:Hide()
                playerFrame.player5MainBetTitle:Hide()
                

                playerFrame.player5SplitH1Title:Show()
                playerFrame.player5SplitH2Title:Show()
                player5SplitH1EditBox:Show()
                player5SplitH2EditBox:Show()
                playerFrame.player5HitButtonSplitH1:Show()
                playerFrame.player5StandButtonSplitH1:Show()
                playerFrame.player5DoubleButtonSplitH1:Show()
                playerFrame.player5HitButtonSplitH2:Show()
                playerFrame.player5StandButtonSplitH2:Show()
                playerFrame.player5DoubleButtonSplitH2:Show()

                betAmount5 = tonumber(player5MainBetEditBox:GetText())
                if betAmount5 then
                    player5SplitH1EditBox:SetText(betAmount5)
                    player5SplitH2EditBox:SetText(betAmount5)
                end

                if playerFrame.dealerCardTotalText:GetText() == "1 or 11" and playerFrame.player5InsuranceYesButton:IsEnabled() and playerFrame.player5InsuranceNoButton:IsEnabled() then
                    SendChatMessage("[P5] NO to Insurance", "RAID")
                    playerFrame.player5InsuranceYesButton:Disable()
                    playerFrame.player5InsuranceNoButton:Disable()
                    player5InsuranceNoIcon:Show()
                end

                timerReset()
            end
        else
            print("You must wait until its your turn.")
        end
    else
        print("You must wait until its your turn.")
    end 
end)
playerFrame.player5DealNowButton:SetScript("OnClick", function()
    SendChatMessage("{moon} " .. playerName .. " has indicated they are ready.", "RAID")
    -- Player 5 bet buttons disabled
    player5ConfirmMainBetButton:Disable()
    player5ConfirmPPBetButton:Disable()
    player5Confirm213BetButton:Disable()
    player5PreloadBetButton:Disable()
    playerFrame.player5DealNowButton:Disable()
end)





-- "Join Table" button
initialFrame.joinButton:SetScript("OnClick", function(self, button, down)
    PlaySoundFile(soundFilePaths[116])
    if button == "LeftButton" then
        initialFrame:Hide()
        playerFrame:Show()
        bankrollFrame:Show()
        SendChatMessage("{circle} " .. playerName .. " has joined the table.", "RAID")
        tableSpectator = true
    end
end)


-- "Return" button
cashDeskFrame.returnButton:SetScript("OnClick", function(self, button, down)
    PlaySoundFile(soundFilePaths[113])
    if button == "LeftButton" then
        cashDeskFrame:Hide()
        initialFrame:Hide()
        stepsFrame:Hide()
        stepsFrame.dealerImage:Hide()
        stepsFrame2:Hide()
        stepsFrame2.dealerImage2:Hide()
        playerFrame:Show()
        bankrollFrame:Show()
        buyInEditBox:SetText("")
        cashOutEditBox:SetText("")
    end
end)
-- "Cash-Out" button
cashDeskFrame.cashOutButton:SetScript("OnClick", function(self, button, down)
    if playerName == unitName1 then
        player1CashOut()
    elseif playerName == unitName2 then
        player2CashOut()
    elseif playerName == unitName3 then
        player3CashOut()
    elseif playerName == unitName4 then
        player4CashOut()
    elseif playerName == unitName5 then
        player5CashOut()
    else
        print("You are not sitting at the table.")
    end
end)
-- "Buy-In" button
cashDeskFrame.buyInButton:SetScript("OnClick", function(self, button, down)
    if playerName == unitName1 then
        player1BuyIn()
    elseif playerName == unitName2 then
        player2BuyIn()
    elseif playerName == unitName3 then
        player3BuyIn()
    elseif playerName == unitName4 then
        player4BuyIn()
    elseif playerName == unitName5 then
        player5BuyIn()
    else
        print("You are not sitting at the table.")
    end
end)




player1dealtCardsFrameSplitH1.playerH2CardsButton:SetScript("OnClick", function(self, button, down)

    player1dealtCardsFrameSplitH2:Show()
    player1dealtCardsFrameSplitH2.playerH1CardsButton:Show()
    player1dealtCardsFrameSplitH2.playerH2CardsButton:Show()
    player1dealtCardsFrameSplitH1:Hide()
    player1dealtCardsFrameSplitH1.playerH1CardsButton:Hide()
    player1dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

end)
player1dealtCardsFrameSplitH2.playerH1CardsButton:SetScript("OnClick", function(self, button, down)

    player1dealtCardsFrameSplitH1:Show()
    player1dealtCardsFrameSplitH1.playerH1CardsButton:Show()
    player1dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    player1dealtCardsFrameSplitH2:Hide()
    player1dealtCardsFrameSplitH2.playerH1CardsButton:Hide()
    player1dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

end)

player2dealtCardsFrameSplitH1.playerH2CardsButton:SetScript("OnClick", function(self, button, down)

    player2dealtCardsFrameSplitH2:Show()
    player2dealtCardsFrameSplitH2.playerH1CardsButton:Show()
    player2dealtCardsFrameSplitH2.playerH2CardsButton:Show()
    player2dealtCardsFrameSplitH1:Hide()
    player2dealtCardsFrameSplitH1.playerH1CardsButton:Hide()
    player2dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

end)
player2dealtCardsFrameSplitH2.playerH1CardsButton:SetScript("OnClick", function(self, button, down)

    player2dealtCardsFrameSplitH1:Show()
    player2dealtCardsFrameSplitH1.playerH1CardsButton:Show()
    player2dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    player2dealtCardsFrameSplitH2:Hide()
    player2dealtCardsFrameSplitH2.playerH1CardsButton:Hide()
    player2dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

end)

player3dealtCardsFrameSplitH1.playerH2CardsButton:SetScript("OnClick", function(self, button, down)

    player3dealtCardsFrameSplitH2:Show()
    player3dealtCardsFrameSplitH2.playerH1CardsButton:Show()
    player3dealtCardsFrameSplitH2.playerH2CardsButton:Show()
    player3dealtCardsFrameSplitH1:Hide()
    player3dealtCardsFrameSplitH1.playerH1CardsButton:Hide()
    player3dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

end)
player3dealtCardsFrameSplitH2.playerH1CardsButton:SetScript("OnClick", function(self, button, down)

    player3dealtCardsFrameSplitH1:Show()
    player3dealtCardsFrameSplitH1.playerH1CardsButton:Show()
    player3dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    player3dealtCardsFrameSplitH2:Hide()
    player3dealtCardsFrameSplitH2.playerH1CardsButton:Hide()

end)

player4dealtCardsFrameSplitH1.playerH2CardsButton:SetScript("OnClick", function(self, button, down)

    player4dealtCardsFrameSplitH2:Show()
    player4dealtCardsFrameSplitH2.playerH1CardsButton:Show()
    player4dealtCardsFrameSplitH2.playerH2CardsButton:Show()
    player4dealtCardsFrameSplitH1:Hide()
    player4dealtCardsFrameSplitH1.playerH1CardsButton:Hide()
    player4dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

end)
player4dealtCardsFrameSplitH2.playerH1CardsButton:SetScript("OnClick", function(self, button, down)

    player4dealtCardsFrameSplitH1:Show()
    player4dealtCardsFrameSplitH1.playerH1CardsButton:Show()
    player4dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    player4dealtCardsFrameSplitH2:Hide()
    player4dealtCardsFrameSplitH2.playerH1CardsButton:Hide()
    player4dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

end)

player5dealtCardsFrameSplitH1.playerH2CardsButton:SetScript("OnClick", function(self, button, down)

    player5dealtCardsFrameSplitH2:Show()
    player5dealtCardsFrameSplitH2.playerH1CardsButton:Show()
    player5dealtCardsFrameSplitH2.playerH2CardsButton:Show()
    player5dealtCardsFrameSplitH1:Hide()
    player5dealtCardsFrameSplitH1.playerH1CardsButton:Hide()
    player5dealtCardsFrameSplitH1.playerH2CardsButton:Hide()

end)
player5dealtCardsFrameSplitH2.playerH1CardsButton:SetScript("OnClick", function(self, button, down)

    player5dealtCardsFrameSplitH1:Show()
    player5dealtCardsFrameSplitH1.playerH1CardsButton:Show()
    player5dealtCardsFrameSplitH1.playerH2CardsButton:Show()
    player5dealtCardsFrameSplitH2:Hide()
    player5dealtCardsFrameSplitH2.playerH1CardsButton:Hide()
    player5dealtCardsFrameSplitH2.playerH2CardsButton:Hide()

end)









-- "Menu" button click
playerFrame.menuButton:SetScript("OnClick", function()
    if menuFrame:IsShown() then
        menuFrame:Hide()
    else
        menuFrame:Show()
    end
end)
-- "Cash Desk" button click
playerFrame.cashDeskButton:SetScript("OnClick", function(self, button, down)
    PlaySoundFile(soundFilePaths[114])
    if button == "LeftButton" then
        cashDeskFrame:Show()
        stepsFrame:Show()
        stepsFrame.dealerImage:Show()
        stepsFrame2:Show()
        stepsFrame2.dealerImage2:Show()
    end
    if playerName == unitName1 then
        cashDeskFrame.player1TotalBankroll:Show()
    elseif playerName == unitName2 then
        cashDeskFrame.player2TotalBankroll:Show()
    elseif playerName == unitName3 then
        cashDeskFrame.player3TotalBankroll:Show()
    elseif playerName == unitName4 then
        cashDeskFrame.player4TotalBankroll:Show()
    elseif playerName == unitName5 then
        cashDeskFrame.player5TotalBankroll:Show()
    end 
end)
-- "Leave Table" button click
playerFrame.leaveTableButton:SetScript("OnClick", function()
    PlaySoundFile(soundFilePaths[117])
    -- Handle the "leaving" action, communicate with players, and change game state
    playerFrame:Hide()
    bankrollFrame:Hide()
    preloadFrame:Hide()
    historyFrame:Hide()
    rulesFrame:Hide()
    payoutsFrame:Hide()
    sideBetWinFramePP:Hide()
    sideBetWinFrame213:Hide()
    player1dealtCardsFrame:Hide()
    player1dealtCardsFrameSplitH1:Hide()
    player1dealtCardsFrameSplitH1:Hide()
    player2dealtCardsFrame:Hide()
    player2dealtCardsFrameSplitH1:Hide()
    player2dealtCardsFrameSplitH1:Hide()
    player3dealtCardsFrame:Hide()
    player3dealtCardsFrameSplitH1:Hide()
    player3dealtCardsFrameSplitH1:Hide()
    player4dealtCardsFrame:Hide()
    player4dealtCardsFrameSplitH1:Hide()
    player4dealtCardsFrameSplitH1:Hide()
    player5dealtCardsFrame:Hide()
    player5dealtCardsFrameSplitH1:Hide()
    player5dealtCardsFrameSplitH1:Hide()
    chatWindowFrame:Hide()
end)
-- "Rules" button click
menuFrame.rulesButton:SetScript("OnClick", function()
    if rulesFrame:IsShown() then
        rulesFrame:Hide()
        rulesFrame.rulesText1:Hide()
        rulesFrame.rulesText2:Hide()
        rulesFrame.rulesText3:Hide()
        rulesFrame.rulesText4:Hide()
        rulesFrame.rulesText5:Hide()
        rulesFrame.rulesText6:Hide()
        rulesFrame.rulesText7:Hide()
        rulesFrame.rulesText8:Hide()
        rulesFrame.rulesText9:Hide()
        rulesFrame.rulesText10:Hide()
        rulesFrame.rulesText11:Hide()
        rulesFrame.HeadingText1:Hide()
        rulesFrame.HeadingText2:Hide()
        rulesFrame.HeadingText3:Hide()
        rulesFrame.HeadingText4:Hide()
        rulesFrame.HeadingText5:Hide()
        rulesFrame.HeadingText6:Hide()
        rulesFrame.HeadingText7:Hide()
        rulesFrame.HeadingText8:Hide()
        rulesFrame.HeadingText9:Hide()
    else
        rulesFrame:Show()
        rulesFrame.rulesText1:Show()
        rulesFrame.rulesText2:Show()
        rulesFrame.rulesText3:Show()
        rulesFrame.rulesText4:Show()
        rulesFrame.rulesText5:Show()
        rulesFrame.rulesText6:Show()
        rulesFrame.rulesText7:Show()
        rulesFrame.rulesText8:Show()
        rulesFrame.rulesText9:Show()
        rulesFrame.rulesText10:Show()
        rulesFrame.rulesText11:Show()
        rulesFrame.HeadingText1:Show()
        rulesFrame.HeadingText2:Show()
        rulesFrame.HeadingText3:Show()
        rulesFrame.HeadingText4:Show()
        rulesFrame.HeadingText5:Show()
        rulesFrame.HeadingText6:Show()
        rulesFrame.HeadingText7:Show()
        rulesFrame.HeadingText8:Show()
        rulesFrame.HeadingText9:Show()
    end
end)
-- "Payouts" button click
menuFrame.payoutsButton:SetScript("OnClick", function()
    if payoutsFrame:IsShown() then
        payoutsFrame:Hide()
        payoutsFrame.mainBetsTitle:Hide()
        payoutsFrame.sideBetsTitle:Hide()
        payoutsFrame.perfectPairsTitle:Hide()
        payoutsFrame.perfectPairsExplain:Hide()
        payoutsFrame.t213Title:Hide()
        payoutsFrame.t213Explain:Hide()
        payoutsFrame.t213Explain2:Hide()
        payoutsFrame.t213Explain3:Hide()
        payoutsFrame.t213Explain4:Hide()
        payoutsFrame.t213Explain5:Hide()
        payoutsFrame.t213Explain6:Hide()
        payoutsFrame.mainBetStandard:Hide()
        payoutsFrame.standardPayout:Hide()
        payoutsFrame.mainBetBlackjack:Hide()
        payoutsFrame.blackjackPayout:Hide()
        payoutsFrame.mixedPairPP:Hide()
        payoutsFrame.mixedPairPayout:Hide()
        payoutsFrame.colouredPairPP:Hide()
        payoutsFrame.colouredPairPayout:Hide()
        payoutsFrame.perfectPairPP:Hide()
        payoutsFrame.perfectPairPayout:Hide()
        payoutsFrame.flush213:Hide()
        payoutsFrame.flushPayout:Hide()
        payoutsFrame.straight213:Hide()
        payoutsFrame.straightPayout:Hide()
        payoutsFrame.threeOfAKind213:Hide()
        payoutsFrame.threeOfAKindPayout:Hide()
        payoutsFrame.straightFlush213:Hide()
        payoutsFrame.straightFlushPayout:Hide()
        payoutsFrame.suitedThreeOfAKind213:Hide()
        payoutsFrame.suitedThreeOfAKindPayout:Hide()
        payoutsFrame.card1image:Hide()
        payoutsFrame.card2image:Hide()
        payoutsFrame.card3image:Hide()
        payoutsFrame.card4image:Hide()
        payoutsFrame.card5image:Hide()
        payoutsFrame.card6image:Hide()
        payoutsFrame.card7image:Hide()
        payoutsFrame.card8image:Hide()
        payoutsFrame.card9image:Hide()
        payoutsFrame.card10image:Hide()
        payoutsFrame.card11image:Hide()
        payoutsFrame.card12image:Hide()
        payoutsFrame.card13image:Hide()
        payoutsFrame.card14image:Hide()
        payoutsFrame.card15image:Hide()
        payoutsFrame.card16image:Hide()
        payoutsFrame.card17image:Hide()
        payoutsFrame.card18image:Hide()
        payoutsFrame.card19image:Hide()
        payoutsFrame.card20image:Hide()
        payoutsFrame.card21image:Hide()
        payoutsFrame.card22image:Hide()
        payoutsFrame.card23image:Hide()
        payoutsFrame.card24image:Hide()
        payoutsFrame.card25image:Hide()
    else
        payoutsFrame:Show()
        payoutsFrame.mainBetsTitle:Show()
        payoutsFrame.sideBetsTitle:Show()
        payoutsFrame.perfectPairsTitle:Show()
        payoutsFrame.perfectPairsExplain:Show()
        payoutsFrame.t213Title:Show()
        payoutsFrame.t213Explain:Show()
        payoutsFrame.t213Explain2:Show()
        payoutsFrame.t213Explain3:Show()
        payoutsFrame.t213Explain4:Show()
        payoutsFrame.t213Explain5:Show()
        payoutsFrame.t213Explain6:Show()
        payoutsFrame.mainBetStandard:Show()
        payoutsFrame.standardPayout:Show()
        payoutsFrame.mainBetBlackjack:Show()
        payoutsFrame.blackjackPayout:Show()
        payoutsFrame.mixedPairPP:Show()
        payoutsFrame.mixedPairPayout:Show()
        payoutsFrame.colouredPairPP:Show()
        payoutsFrame.colouredPairPayout:Show()
        payoutsFrame.perfectPairPP:Show()
        payoutsFrame.perfectPairPayout:Show()
        payoutsFrame.flush213:Show()
        payoutsFrame.flushPayout:Show()
        payoutsFrame.straight213:Show()
        payoutsFrame.straightPayout:Show()
        payoutsFrame.threeOfAKind213:Show()
        payoutsFrame.threeOfAKindPayout:Show()
        payoutsFrame.straightFlush213:Show()
        payoutsFrame.straightFlushPayout:Show()
        payoutsFrame.suitedThreeOfAKind213:Show()
        payoutsFrame.suitedThreeOfAKindPayout:Show()
        payoutsFrame.card1image:Show()
        payoutsFrame.card2image:Show()
        payoutsFrame.card3image:Show()
        payoutsFrame.card4image:Show()
        payoutsFrame.card5image:Show()
        payoutsFrame.card6image:Show()
        payoutsFrame.card7image:Show()
        payoutsFrame.card8image:Show()
        payoutsFrame.card9image:Show()
        payoutsFrame.card10image:Show()
        payoutsFrame.card11image:Show()
        payoutsFrame.card12image:Show()
        payoutsFrame.card13image:Show()
        payoutsFrame.card14image:Show()
        payoutsFrame.card15image:Show()
        payoutsFrame.card16image:Show()
        payoutsFrame.card17image:Show()
        payoutsFrame.card18image:Show()
        payoutsFrame.card19image:Show()
        payoutsFrame.card20image:Show()
        payoutsFrame.card21image:Show()
        payoutsFrame.card22image:Show()
        payoutsFrame.card23image:Show()
        payoutsFrame.card24image:Show()
        payoutsFrame.card25image:Show()
    end
end)
-- "History" button click
playerFrame.historyButton:SetScript("OnClick", function()

    if historyFrame:IsShown() then
        historyFrame:Hide()
        historyFrame.totalWageredText:Hide()
        historyFrame.totalWonText:Hide()
        historyFrame.totalLostText:Hide()
        historyFrame.ProfitText:Hide()

        if playerName == unitName1 then
            historyFrame.player1totalWageredAmount:Hide()
            historyFrame.player1totalWonAmount:Hide()
            historyFrame.player1totalLostAmount:Hide()
            historyFrame.player1ProfitAmount:Hide()
        elseif playerName == unitName2 then
            historyFrame.player2totalWageredAmount:Hide()
            historyFrame.player2totalWonAmount:Hide()
            historyFrame.player2totalLostAmount:Hide()
            historyFrame.player2ProfitAmount:Hide()
        end

    else
        historyFrame:Show()
        historyFrame.totalWageredText:Show()
        historyFrame.totalWonText:Show()
        historyFrame.totalLostText:Show()
        historyFrame.ProfitText:Show()

        if playerName == unitName1 then
            historyFrame.player1totalWageredAmount:Show()
            historyFrame.player1totalWonAmount:Show()
            historyFrame.player1totalLostAmount:Show()
            historyFrame.player1ProfitAmount:Show()
        elseif playerName == unitName2 then
            historyFrame.player2totalWageredAmount:Show()
            historyFrame.player2totalWonAmount:Show()
            historyFrame.player2totalLostAmount:Show()
            historyFrame.player2ProfitAmount:Show()
        end

    end
end)
-- "Rebet" button click
menuFrame.preloadButton:SetScript("OnClick", function()

    if preloadFrame:IsShown() then
        preloadFrame:Hide()
        preloadFrame.preloadMainBetText:Hide()
        preloadFrame.preloadPPBetText:Hide()
        preloadFrame.preload213BetText:Hide()

        if playerName == unitName1 then
            player1PreloadEditBoxMainBet:Hide()
            player1PreloadEditBoxPPBet:Hide()
            player1PreloadEditBox213Bet:Hide()
            player1PreloadBetButton:Hide()
        elseif playerName == unitName2 then
            player2PreloadEditBoxMainBet:Hide()
            player2PreloadEditBoxPPBet:Hide()
            player2PreloadEditBox213Bet:Hide()
            player2PreloadBetButton:Hide()
        end

    else
        preloadFrame:Show()
        preloadFrame.preloadMainBetText:Show()
        preloadFrame.preloadPPBetText:Show()
        preloadFrame.preload213BetText:Show()

        if playerName == unitName1 then
            player1PreloadEditBoxMainBet:Show()
            player1PreloadEditBoxPPBet:Show()
            player1PreloadEditBox213Bet:Show()
            player1PreloadBetButton:Show()
        elseif playerName == unitName2 then
            player2PreloadEditBoxMainBet:Show()
            player2PreloadEditBoxPPBet:Show()
            player2PreloadEditBox213Bet:Show()
            player2PreloadBetButton:Show()
        elseif playerName == unitName3 then
            player3PreloadEditBoxMainBet:Show()
            player3PreloadEditBoxPPBet:Show()
            player3PreloadEditBox213Bet:Show()
            player3PreloadBetButton:Show()
        elseif playerName == unitName4 then
            player4PreloadEditBoxMainBet:Show()
            player4PreloadEditBoxPPBet:Show()
            player4PreloadEditBox213Bet:Show()
            player4PreloadBetButton:Show()
        elseif playerName == unitName5 then
            player5PreloadEditBoxMainBet:Show()
            player5PreloadEditBoxPPBet:Show()
            player5PreloadEditBox213Bet:Show()
            player5PreloadBetButton:Show()
        end

    end
end)
-- "Cards" button click
menuFrame.cardsButton:SetScript("OnClick", function()

    if playerName == unitName1 then

        if player1dealtCardsFrame:IsShown() then
            player1dealtCardsFrame:Hide()
            player1dealtCardsFrame.playerCardsButton:Hide()
        else
            if player1SplitToggle == true then
                player1dealtCardsFrameSplitH1:Show()
                player1dealtCardsFrameSplitH1.playerH1CardsButton:Show()
                player1dealtCardsFrameSplitH1.playerH2CardsButton:Show()
            else
                player1dealtCardsFrame:Show()
                player1dealtCardsFrame.playerCardsButton:Show()
                if gameRunning == false then
                    player1dealtCardsFrame.notStartedYetText:Show()
                else
                end
            end
        end

    elseif playerName == unitName2 then

        if player2dealtCardsFrame:IsShown() then
            player2dealtCardsFrame:Hide()
            player2dealtCardsFrame.playerCardsButton:Hide()
        else
            if player2SplitToggle == true then
                player2dealtCardsFrameSplitH1:Show()
                player2dealtCardsFrameSplitH1.playerH1CardsButton:Show()
                player2dealtCardsFrameSplitH1.playerH2CardsButton:Show()
            else
                player2dealtCardsFrame:Show()
                player2dealtCardsFrame.playerCardsButton:Show()
                if gameRunning == false then
                    player2dealtCardsFrame.notStartedYetText:Show()
                else
                end
            end
        end
    
    elseif playerName == unitName3 then

        if player3dealtCardsFrame:IsShown() then
            player3dealtCardsFrame:Hide()
            player3dealtCardsFrame.playerCardsButton:Hide()
        else
            if player3SplitToggle == true then
                player3dealtCardsFrameSplitH1:Show()
                player3dealtCardsFrameSplitH1.playerH1CardsButton:Show()
                player3dealtCardsFrameSplitH1.playerH2CardsButton:Show()
            else
                player3dealtCardsFrame:Show()
                player3dealtCardsFrame.playerCardsButton:Show()
                if gameRunning == false then
                    player3dealtCardsFrame.notStartedYetText:Show()
                else
                end
            end
        end
    
    elseif playerName == unitName4 then

        if player4dealtCardsFrame:IsShown() then
            player4dealtCardsFrame:Hide()
            player4dealtCardsFrame.playerCardsButton:Hide()
        else
            if player4SplitToggle == true then
                player4dealtCardsFrameSplitH1:Show()
                player4dealtCardsFrameSplitH1.playerH1CardsButton:Show()
                player4dealtCardsFrameSplitH1.playerH2CardsButton:Show()
            else
                player4dealtCardsFrame:Show()
                player4dealtCardsFrame.playerCardsButton:Show()
                if gameRunning == false then
                    player4dealtCardsFrame.notStartedYetText:Show()
                else
                end
            end
        end
    
    elseif playerName == unitName5 then

        if player5dealtCardsFrame:IsShown() then
            player5dealtCardsFrame:Hide()
            player5dealtCardsFrame.playerCardsButton:Hide()
        else
            if player5SplitToggle == true then
                player5dealtCardsFrameSplitH1:Show()
                player5dealtCardsFrameSplitH1.playerH1CardsButton:Show()
                player5dealtCardsFrameSplitH1.playerH2CardsButton:Show()
            else
                player5dealtCardsFrame:Show()
                player5dealtCardsFrame.playerCardsButton:Show()
                if gameRunning == false then
                    player5dealtCardsFrame.notStartedYetText:Show()
                else
                end
            end
        end

    end
end)
-- "Chat Log" button click
menuFrame.chatLogButton:SetScript("OnClick", function()

    if chatWindowFrame:IsShown() then
        chatWindowFrame:Hide()
    else
        chatWindowFrame:Show()
    end

end)












playerFrame:SetScript("OnMouseDown", function(self, button)
    if button == "LeftButton" then
        -- >> PLAYER 1 <<
        player1MainBetEditBox:ClearFocus()
        player1PPBetEditBox:ClearFocus()
        player1213BetEditBox:ClearFocus()
        player1PreloadEditBoxMainBet:ClearFocus()
        player1PreloadEditBoxPPBet:ClearFocus()
        player1PreloadEditBox213Bet:ClearFocus()

        -- >> PLAYER 2 <<
        player2MainBetEditBox:ClearFocus()
        player2PPBetEditBox:ClearFocus()
        player2213BetEditBox:ClearFocus()  
        player2PreloadEditBoxMainBet:ClearFocus()
        player2PreloadEditBoxPPBet:ClearFocus()
        player2PreloadEditBox213Bet:ClearFocus()

        -- >> PLAYER 3 <<
        player3MainBetEditBox:ClearFocus()
        player3PPBetEditBox:ClearFocus()
        player3213BetEditBox:ClearFocus()  
        player3PreloadEditBoxMainBet:ClearFocus()
        player3PreloadEditBoxPPBet:ClearFocus()
        player3PreloadEditBox213Bet:ClearFocus()

        -- >> PLAYER 4 <<
        player4MainBetEditBox:ClearFocus()
        player4PPBetEditBox:ClearFocus()
        player4213BetEditBox:ClearFocus()  
        player4PreloadEditBoxMainBet:ClearFocus()
        player4PreloadEditBoxPPBet:ClearFocus()
        player4PreloadEditBox213Bet:ClearFocus()

        -- >> PLAYER 5 <<
        player5MainBetEditBox:ClearFocus()
        player5PPBetEditBox:ClearFocus()
        player5213BetEditBox:ClearFocus()  
        player5PreloadEditBoxMainBet:ClearFocus()
        player5PreloadEditBoxPPBet:ClearFocus()
        player5PreloadEditBox213Bet:ClearFocus()

        tipDealerEditBox:ClearFocus()
        
    end
end)

-- Slash command handler for the player
SlashCmdList["BLACKJACK"] = function(msg)
    if msg == "" then
        initialFrame:Show()
        SendChatMessage("{moon} " .. playerName .. " has entered the waiting room.", "RAID")
        -- Handle the "/blackjack" command
    else
        print("Invalid command. Usage: /blackjack")
    end
end

-- Register the slash command
SLASH_BLACKJACK1 = "/blackjack"
SLASH_BLACKJACK2 = "/bj"