[help] show ping in drawtext

Hi i try to make a script there shows the ping in hud. the script working fine . the problem is the drawtxt is blinking i tried to put Citizen.Wait (0) but no difference

                              CLIENT.LUA
Citizen.CreateThread(function()
    while true do
    	Citizen.Wait(0)
		TriggerServerEvent("getinfo")
	end
end)

RegisterNetEvent('information')
AddEventHandler('information', function(ping)
	drawTxt('~b~PING: ~w~'..ping, 0, 1, 0.5, 0.8, 0.6, 255, 255, 255, 255)
end)

function drawTxt(text, font, centre, x, y, scale, r, g, b, a)
	SetTextFont(font)
	SetTextProportional(0)
	SetTextScale(scale, scale)
	SetTextColour(r, g, b, a)
	SetTextDropShadow(0, 0, 0, 0, 255)
	SetTextEdge(1, 0, 0, 0, 255)
	SetTextDropShadow()
	SetTextOutline()
	SetTextCentre(centre)
	SetTextEntry("STRING")
	AddTextComponentString(text)
	DrawText(x, y)
end
                          SERVER.LUA
-- server.lua
RegisterServerEvent('getinfo')
AddEventHandler('getinfo', function()
	local ping = GetPlayerPing(source)
	TriggerClientEvent('information', source, ping)
end)

You’re triggering a server event every frame. Seems excessive tbh.

You don’t have ping defined in client

what should i do? someone else said:

“I suggest having a draw thread whichs just calls drawtxt every tick and then having another thread which requests the user ping every 1000ms or something and then set it in a variable which the draw thread can use”

but I don’t understand how to do it

the ping is displayed correctly, but it blinks all the time :confused: