Draw a line to each active ID/player?

Hi!

I have a es_admin command: /drawline
This is how it looks:

RegisterNetEvent('es_admin:snaplines')
AddEventHandler('es_admin:snaplines', function(t)

    if snapActive then
        snapActive = false
        TriggerEvent("chatMessage", "SYSTEM", { 255,0,0}, "Snaplines are now hidden!")
    else
        snapActive = true
        TriggerEvent("chatMessage", "SYSTEM", { 255,0,0}, "Snaplines are now shown!")
    end

	while snapActive do
		Wait(0)
        local players = ESX.Game.GetPlayers()
        for i = 1, #players, 1 do
            if players[i] ~= PlayerId() then
                local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1),true))
                local x2,y2,z2 = table.unpack(GetEntityCoords(GetPlayerPed(players[i]),true))
                DrawLine(x, y, z, x2, y2, z2, 255, 0, 0, 255)
            end
		end
    end
end)

This semi-works the problem I currently face is that it if not a line to each player instead it flickers to everyone, any suggestions on what I should do to draw a line to each player?

Get the player coords in one thread, draw the lines in another.