How would I script a player-region finder?

Hey there!

As Admino’s first beta release is expected to come out right around the corner, I’m in need of some help in scripting a player-region locator.

So basically, Admino has a small country icon in the top-right corner of the panel bar. However, instead of using time on making a manual region selector, I was wondering if it would be possible to script an automatic player region finder, which would change the country icon based on the player’s current region. This way, you won’t have to manually select your current region, and it will save a lot of time from making more interfaces.

The issue is, I have no idea how to script this. I only know that it involves changing the “rbxassetid” of the country icon image, when the scripts determines the region of the local player. I’ve tried to look it up on Google search but I only got results for color regions.

Any help would be appreciated!

Sorry for the incredibly slow response.

You can get a player’s country via a bunch of services, I found this source code that may help:

local LS = game:GetService("LocalizationService")

game.Players.PlayerAdded:Connect(function(plr)
	local region = LS:GetCountryRegionForPlayerAsync(plr)
	print(plr.Name .."'s Region is: "..region)
end)

You can then compare the countries code and then get the flag needed.

This script is server side, so you may need to change it up a bit, let me know if you need any help!

1 Like

Thanks for the help!

I do have two questions about this;

  • Does this script go into a folder (such as ReplicatedFirst or ServerScriptStorage), or should it be going as a child script under its parent?

  • I know I can change the “print()” line to be an image ID changer, but how would the right image ID be selected and displayed, according to the region? (e.g. script detects I’m in “Canada,” how would it know which flag image ID should it display?)

You’ll have to experiment with the replicatedfirst or ServerScript, you’ll have to probably use a dictionary linking the codes to the flags & then showing them appropriately.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.