Created
December 3, 2022 20:01
-
-
Save cxmeel/40c9e3829c71ad656696a45b9f54647b to your computer and use it in GitHub Desktop.
Generate a flag emoji from the player's region
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--!strict | |
local regionalIndicators = { A = "๐ฆ", B = "๐ง", C = "๐จ", D = "๐ฉ", E = "๐ช", F = "๐ซ", G = "๐ฌ", H = "๐ญ", I = "๐ฎ", J = "๐ฏ", K = "๐ฐ", L = "๐ฑ", M = "๐ฒ", N = "๐ณ", O = "๐ด", P = "๐ต", Q = "๐ถ", R = "๐ท", S = "๐ธ", T = "๐น", U = "๐บ", V = "๐ป", W = "๐ผ", X = "๐ฝ", Y = "๐พ", Z = "๐ฟ" } | |
local function constructFlagEmoji(region: string): string | |
local flag = {} | |
for _, char in region:split("") do | |
table.insert(flag, regionalIndicators[char:upper()]) | |
end | |
return table.concat(flag, "") | |
end | |
local region = LocalizationService:GetCountryRegionForPlayerAsync(player) | |
local flag = constructFlagEmoji(region) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment