Thats probably because server-side is running before client side, so, in this case, you should make a trigger from the client to the server and send the response back to the client again. Not sure if there is a better option for it cuz using a timer is not a good idea aswell ...
So here goes my solution:
-- ## CLIENT-SIDE
local myCountry = ""
addEvent("onPlayerCountryReceived", true)
addEventHandler("onPlayerCountryReceived", root, function(country)
outputChatBox(country)
myCountry = country
end)
addEventHandler("onClientResourceStart", resourceRoot, function ()
triggerServerEvent("onRequestPlayerCountry", resourceRoot)
end)
-- ## SERVER-SIDE
addEvent("onRequestPlayerCountry", true)
addEventHandler("onRequestPlayerCountry", resourceRoot, function()
local country = exports.admin:getPlayerCountry(client)
triggerClientEvent(client, "onPlayerCountryReceived", resourceRoot, country)
end)