Looping through players to send a report to admins

Hello,
I made this command that will send a report to online admins but the report message is sent X times to every admin, and X is the number of admins online.

So if 3 admins are online, the report is received 3 times - and if only 1 admin is online, the report message is only received once.

CODE:

RegisterCommand('report', function(source, args, raw)
	local name = GetPlayerName(source)
	local textmsg = table.concat(args, " ",1)
	local xAll = ESX.GetPlayers()
	for i=1, #xAll, 1 do
      	local xTarget = ESX.GetPlayerFromId(xAll[i])
      	if xTarget.getGroup() == 'admin' then
            TriggerClientEvent('chatMessage', xTarget.source, "", {255, 0, 0}, "^3[REPORT]^0 | ^1[".. source .."] ^0" .. name .." "..":  " .. textmsg)
        end
    end
	TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'success', text = 'Rapport envoyé!', length = 6000})
end)

bumping

I really need help with this … bump

instead of looping through all players by step I used
for k,v in pairs(xAll) do
and managed to send the message once to every admin :grin: