I’m using this line:
Http:GetAsync("https://games.roblox.com/v1/games/5379581123/servers/Public?limit=10)"
and getting this error:
Why is this happening? Any help is appreciated.
I’m using this line:
Http:GetAsync("https://games.roblox.com/v1/games/5379581123/servers/Public?limit=10)"
and getting this error:
Try replacing roblox.com
with rprxy.xyz
.
You can’t make requests to roblox directly from a game.
Roblox blocks direct request for obvious reasons (ddos intensifies) . You just have to do as @nicemike40 suggested and switch out roblox.com
with rprxy.xyz
.
For example:
-- Variables --
local HS = game:GetService("HttpService");
local PlaceID = 5379581123; -- Your place id
local ServersToGet = 10; -- Amount of servers you want the API to return (note it can only be 10, 25, 50, or 100 otherwise it errors)
local Key = "https://games.rprxy.xyz/v1/games/"..PlaceID.."/servers/Public?sortOrder=Asc&limit="..ServersToGet;
local Response = HS:JSONDecode(HS:GetAsync(Key)); -- Should prob keep these seperate and/or wrap in a pcall
-- Loop --
for Index, ServerData in ipairs(Response.data) do -- All information about the servers stored in the "data" table.
print(Index, ServerData);
end;
Hope this helps!
There is a bracket inside of the quotation marks when it need to be outside of them like this: (“http key”)