if ServerData then
ServerData = HttpService:JSONDecode(ServerData)
end
local suc, getIp = pcall(function()
return HttpService:GetAsync("https://ipconfig.io/json")
end)
local serverIP
if getIp then
local ipData = HttpService:JSONDecode(getIp)
serverIP = ipData["ip"]
end
local Success, ServerData = pcall(function()
return HttpService:GetAsync("https://ipapi.co/"..serverIP.."/json/")
end)
if ServerData then
ServerData = HttpService:JSONDecode(ServerData)
end
for _, sufgui in pairs(CollectionService:GetTagged("info")) do
local frame = sufgui:FindFirstChild("Frame")
if not frame then return end
for _, textlabel in pairs(frame:GetChildren()) do
if not textlabel:IsA("TextLabel") then
continue
end
if not ServerData[textlabel.Name] then
continue
end
textlabel.Text = string.upper(textlabel.Name..": "..ServerData[textlabel.Name])
end
end
I’m not good with JSON can anyone help me figure out what I need to do?
What error is it returning? Try printing the getIp result and check what it actually returns. If everything looks fine, then try publishing new version of the game and retry.
You should be confirming that Success is even true before trying to do anything with ServerData. It’s most likely that the parsing is failing because Success is false and ServerData is in turn the error message HttpService returned.
The API you are trying to use likely gets used quite a lot in Roblox games leading to that service provider rate limiting requests from Roblox servers. When you make that same request in studio it is coming from your own device and not a Roblox server so it isn’t being rate limited.