local LocalizationService = game:GetService("LocalizationService")
local HttpService = game:GetService("HttpService")
local Player = game.Players
local countryFlagJSON = "http://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/index.json"
local function countryCodeToEmoji(countryCode: string)
local jsonTable = HttpService:GetAsync(countryFlagJSON)
local countryTable = HttpService:JSONDecode(jsonTable)
local emoji = ""
for _, country in ipairs(countryTable) do
if country.code == countryCode then
emoji = country.code
end
end
return emoji
end
local function onPlayerAdded(player)
local Code = LocalizationService:GetCountryRegionForPlayerAsync(player)
local Flag = countryCodeToEmoji(Code)
end
Player.PlayerAdded:Connect(onPlayerAdded)
2 Likes