Try those steps one step at time:
1-Open cmd and type ipconfig /flushdns, ipconfig /release and ipconfig /renew
2-Clear your Fivem game cache.
3-Update your gta from steam or epic games.
4-Make sure your pc date and time is matching your irl date and time.
5-Update your gpu.
6-Reinstall fivem.
7-Try planet vpn, its a free vpn.
8-Restart your wifi device completely which means unplug it for 1M and plug it back in.
9-Reach to your internet provider asking them to put you on google dns.
10-Reinstall windows 10 which fix it in most cases.