I think fetching information from roblox api works on local scripts, right?
so why doesnt this work?
local http = game:GetService("HttpService")
local function updateGUI(name)
local maxtries = 3
local tries = 0
local success, response
print("httpenabled: " .. tostring(http.HttpEnabled))
repeat
tries += 1
success, response = pcall(function()
http:GetAsync("https://games.roblox.com/v1/games?universeIds=" .. name)
end)
if not success then
warn("didnt work on try" .. tostring(tries) .. " because " .. response)
end
until success or tries >= maxtries
return success, response
end
local list = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("List"):WaitForChild("List")
for _, v in pairs(list:GetChildren()) do
if v:IsA("Frame") then
local success, response = updateGUI(v.Name)
if success then
local decoded, json = pcall(function()
return http:JSONDecode(response)
end)
local text = list:FindFirstChild(tostring(v)).GameName
if decoded and json and json.data and json.data[1] then text.Text = json.data[1].name
else text.Text = "Failed to load game"
end
end
end
end
http requests are on, and sudio access to api services is enabled
yet the console outputs "httpenabled: false"
and warns "didnt work on try1 because Http requests can only be executed by game server"
can anyone help?
** You are now Level 3! **