The variables i use only changes after I open the menu a second time [esx_menu_default]

I have an admin script and I included in it badger’s spectate system from his badger tool’s script now I am making a menu so administrators can see the spectated player’s health, armor, cash, bank, inventory, the only issue is that if I press Q (that’s what I have binded the menu to) while spectating someone the menu opens up but it says at the cash and bank part that it’s zero (the hp and armor works just fine) and if I press Q again it shows the right amount of money the player has. I want to make it so I don’t have to press it a second time.

server.lua:

RegisterServerEvent('pho_admin:getspectated')
AddEventHandler('pho_admin:getspectated', function(targetId) 
    local xPlayer = ESX.GetPlayerFromId(source)
    if isGroupAdmin(xPlayer.getGroup()) then
        if isPlayerOnDuty(source) then
			local xTarget = ESX.GetPlayerFromId(targetId)
			local money = xTarget.getAccount('money').money
			local bank = xTarget.getAccount('bank').money
			TriggerClientEvent("pho_admin:menudata", source, money, bank)
		end
	end
end)

client.lua:

cash = 0
bankaccount = 0

RegisterNetEvent("pho_admin:menudata")
AddEventHandler("pho_admin:menudata", function(money, bank)
	cash = money
	bankaccount = bank
end)

function infomenu()
	ESX.UI.Menu.CloseAll() 
	TriggerServerEvent('pho_admin:getspectated', spectatedUserServerID)	

	ESX.UI.Menu.Open(
	  'default', GetCurrentResourceName(), 'spec_info',
	  {
		title    = "Spectate Info",
		align    = 'top-right',
		elements = {

		  {label = 'INVENTORY', value = 'inventory'},
		  {label = 'KÉSZPÉNZ: '..cash.. '$'},
		  {label = 'BANK: '..bankaccount..'$'},		
		  {label = 'ÉLETERŐ: '..GetEntityHealth(GetPlayerPed(spectatedUserClientID))},  
		  {label = 'PÁNCÉL: '..GetPedArmour(GetPlayerPed(spectatedUserClientID))},		  
		},
	  },
	  function(data, menu)
		local player, distance = ESX.Game.GetClosestPlayer()

		
		if data.current.value == 'inventory' then
		  TriggerCommand('ox_inventory:viewInventory', spectatedUserServerID)
		end
	  end,
	  function(data, menu)
		menu.close()
	  end
	)
end	

and I call in the menu like this in the client.lua:

			if IsControlJustReleased(0, 44) then 
				infomenu()
			end

Update:
I came up with a solution I move the ServerEvent to trigger before the menu then I put a Wait for delay, it’s not the perfect solution so if anyone got any better I would appreciate it.

			if IsControlJustReleased(0, 44) then 
                TriggerServerEvent('pho_admin:getspectated', spectatedUserServerID)	
                Wait(100)
				infomenu()
			end