Greetings, Developers! I am currently experiencing with the Local Currency function but it’s not how I think it should work. Anyone feedbacks?
local AssignedColor = game:GetService("StarterGui").ParcelHub.Color:GetAttribute("Color")
local SubscriptionID = "EXP-blah blah blah"
local SubscriptionPriceUSD = 2.99
local player = game.Players.LocalPlayer
local currencySymbol = "$"
local subscriptionPrice = SubscriptionPriceUSD
local function getCurrencySymbolForLocale(locale)
if locale == "en-US" then
return "$", SubscriptionPriceUSD -- USD
elseif locale == "en-GB" then
return "£", SubscriptionPriceUSD * 0.8 -- GBP
elseif locale == "de-DE" then
return "€", SubscriptionPriceUSD * 0.9 -- EUR
elseif locale == "ja-JP" then
return "¥", SubscriptionPriceUSD * 130 -- JPY
elseif locale == "fr-FR" then
return "€", SubscriptionPriceUSD * 0.85 -- EUR for France
elseif locale == "es-ES" then
return "€", SubscriptionPriceUSD * 0.9 -- EUR for Spain
elseif locale == "it-IT" then
return "€", SubscriptionPriceUSD * 0.85 -- EUR for Italy
elseif locale == "pt-BR" then
return "R$", SubscriptionPriceUSD * 5.2 -- BRL
elseif locale == "ru-RU" then
return "₽", SubscriptionPriceUSD * 80 -- Russian Ruble
elseif locale == "ko-KR" then
return "₩", SubscriptionPriceUSD * 1300 -- KRW
elseif locale == "cs-CZ" then
return "Kč", SubscriptionPriceUSD * 22 -- CZK (Czech Koruna)
elseif locale == "pl-PL" then
return "zł", SubscriptionPriceUSD * 4.5 -- PLN (Polish Zloty)
else
return "$", SubscriptionPriceUSD -- Default to USD if no match
end
end
local playerLocale = player and player.LocaleId or "en-US"
currencySymbol, subscriptionPrice = getCurrencySymbolForLocale(playerLocale)
local function formatPrice(price)
return string.format("%.2f", price)
end
while true do -- Ignore this while loop as I'm trying to do a Custom Parcel Hub and lazy to edit the main script of the hub
script.Parent.TextColor3 = AssignedColor
script.Parent.Text = currencySymbol .. formatPrice(subscriptionPrice)
wait(0.1)
end