Having problems getting players server region

Hi there, I’ve recently been implementing this feature into a game I’m working on, I’ve looked at the resource LocalizationService:GetCountryRegionForPlayerAsync and used that to make this so far

My code:

local placeVersion = game.PlaceVersion

game.StarterGui.UIUSERSTATS.TextLabel.Text = string.format("Server version: %s", placeVersion)

local LocalizationService = game:GetService("LocalizationService")
local player = game.Players.LocalPlayer

game.StarterGui.UIUSERSTATS.TextLabel2.Text = string.format("Client Location: %s", LocalizationService:GetCountryRegionForPlayerAsync(player))

Error: Argument 1 missing or nil - Server - VersionGui:8
Any help is appreciated greatly, thank you.

try debugging make sure you test it beforehand


still returning with the original error,

Change this into a local script. Only local scripts can access LocalPlayer. Also, do not use game.StarterGui to edit GUI’s. Use PlayerGui.

local player = game.Players.LocalPlayer
local placeVersion = game.PlaceVersion

player.PlayerGui.UIUSERSTATS.TextLabel.Text = string.format("Server version: %s", placeVersion)

local LocalizationService = game:GetService("LocalizationService")

player.PlayerGui.UIUSERSTATS.TextLabel2.Text = string.format("Client Location: %s", LocalizationService:GetCountryRegionForPlayerAsync(player))

I tried your code and added a print feature to check if it was working as it wasn’t displaying any errors but wasn’t printing either or changing the text.
just to let you know, I am doing this in a ServerScriptStorage.

Put the local script inside StarterGui.

1 Like

I have one more question, could you point me in the right direction for how to get a players current client? (mobile, console, computer, etc?)