Hi, I was creating a modulescript which gets data, and nothing seems to work. every api has failed, saying https: sslconnectfail. I am pretty sure it’s from the api, but maybe it’s my code as well. Any help would be appreciated.
--// Type Definitions.
type Array<Type> = {[number] : Type};
type Dictionary<Type> = {[string] : Type};
--// Plugin Initalization.
local DataFetcher = {};
local HttpService = game:GetService("HttpService")
local MarketplaceService = game:GetService("MarketplaceService")
local UniverseFetchRootUrl = "https://apis.roproxy.com/universes/get-universe-containing-place?placeid=%s"
local GamepassFetchRootUrl = "https://games.roproxy.com/v1/games/%s/game-passes?sortOrder=Asc&limit=100"
local GamepassFetchAltUrl = "https://inventory.roproxy.com/v1/users/%s/inventory/GamePass?itemsPerPage=100"
local GamesFetchRootUrl = "https://games.roproxy.com/v2/users/%s/games?sortOrder=Asc&limit=50"
--// Plugin Actions.
function DataFetcher:GetUniverseIdFromPlaceId(PlaceId)
local Url = UniverseFetchRootUrl:format(PlaceId)
local OperationSuccessful = false
local UserFrontfacingMessage = ""
local UniverseId = nil
local ReturnData = nil
local Success, ErrorMessage = pcall(function()
ReturnData = HttpService:GetAsync(Url)
end)
if Success then
if ReturnData then
local FormattedReturnData = HttpService:JSONDecode(ReturnData)
if FormattedReturnData.Errors then
local Error = FormattedReturnData.Errors[1]
UserFrontfacingMessage = Error.message
warn(Error.message)
else
OperationSuccessful = true
UniverseId = FormattedReturnData.UniverseId
end
else
UserFrontfacingMessage = "There was an error. Try again!"
warn("No return data in fetching universe id")
end
else
UserFrontfacingMessage = "There was an error. Try again!"
warn("No success in fetching universe id")
warn(ErrorMessage)
end
return OperationSuccessful, UserFrontfacingMessage, UniverseId
end
function DataFetcher:GetGamepassesFromUniverseId(UniverseId)
local Url = GamepassFetchRootUrl:format(UniverseId)
local OperationSuccessful = false
local UserFrontfacingMessage = ""
local Gamepasses = nil
local ReturnData = nil
local Success, ErrorMessage = pcall(function()
ReturnData = HttpService:GetAsync(Url)
end)
if Success then
if ReturnData then
local FormattedReturnData = HttpService:JSONDecode(ReturnData)
if FormattedReturnData.Errors then
local Error = FormattedReturnData.Errors[1]
UserFrontfacingMessage = Error.message
warn(Error.message)
else
OperationSuccessful = true
local GamepassData = FormattedReturnData.data
Gamepasses = {}
for _, GamepassInfo in GamepassData do
if GamepassInfo.price and GamepassInfo.price > 0 then
Gamepasses[#Gamepasses + 1] = {
Id = GamepassInfo.id,
Name = GamepassInfo.displayName,
Price = GamepassInfo.price,
}
end
end
end
else
UserFrontfacingMessage = "There was an error. Try again!"
warn("No return data in fetching gamepasses")
end
else
UserFrontfacingMessage = "There was an error. Try again!"
warn("No success in fetching gamepasses")
warn(ErrorMessage)
end
return OperationSuccessful, UserFrontfacingMessage, Gamepasses
end
function DataFetcher:GetGamesFromPlayer(Player)
local UserId = Player.UserId
local Url = GamesFetchRootUrl:format(UserId)
local OperationSuccessful = false
local UserFrontfacingMessage = ""
local Games = nil
local ReturnData = nil
local Success, ErrorMessage = pcall(function()
ReturnData = HttpService:GetAsync(Url)
end)
if Success then
if ReturnData then
local FormattedReturnData = HttpService:JSONDecode(ReturnData)
if FormattedReturnData.Errors then
local Error = FormattedReturnData.Errors[1]
UserFrontfacingMessage = Error.message
warn(Error.message)
else
OperationSuccessful = true
local GameData = FormattedReturnData.data
Games = {}
for _, GamepassInfo in GameData do
Games[#Games + 1] = GamepassInfo.id
end
end
else
UserFrontfacingMessage = "There was an error. Try again!"
warn("No return data in fetching games")
end
else
UserFrontfacingMessage = "There was an error. Try again!"
warn("No success in fetching games")
warn(ErrorMessage)
end
return OperationSuccessful, UserFrontfacingMessage, Games
end
function DataFetcher:GetGamepassesFromPlayer(Player)
local Success, Error, Games = self:GetGamesFromPlayer(Player)
if not Success then
return Success, Error, nil
end
local AllGamepasses = {}
for _, GameId in Games do
local Success, Error, Gamepasses = self:GetGamepassesFromUniverseId(GameId)
if not Success then
return Success, Error, nil
end
for _, GamepassInfo in Gamepasses do
table.insert(AllGamepasses, GamepassInfo)
end
end
return true, "", AllGamepasses
end
--// Plugin Finalization.
return (DataFetcher);```