I want to get all the ids of the outfits so i can load there avatars
my issue is that i get this error HttpService is not allowed to access ROBLOX resources so i am asking for another way to do this.
Current Code:
game:GetService("ReplicatedStorage"):WaitForChild("GetAvatar").OnServerEvent:Connect(function(plr,url)
local suc,err = pcall(function()
local HttpService = game:GetService("HttpService")
local request = HttpService:GetAsync(url)
local decoded = HttpService:JSONDecode(request)
if not decoded.data then
return warn("Unable to get outfits.")
else
print(decoded.data)
end
end)
if err then
warn(err)
end
end)
the image attached is what is meant by “outfits”
You can’t use the ordinary Roblox player service to obtain all the outfits, but can through their API services! Using a proxy, you can obtain their outfits using the function provided below:
function GetPlayerOutfits(userid)
local ProxyUrl = "https://avatar.roproxy.com/v1/users/%d/outfits?page=%d"
local Outfits = {}
for PageNumber = 1, 2 do
task.wait(7)
local RequestUrl = string.format(ProxyUrl, userid, PageNumber)
local Success, Result = pcall(game:GetService("HttpService").GetAsync, game:GetService("HttpService"), RequestUrl) --> Gets their outfits
if Success then
if Result then
local success2, result2 = pcall(game:GetService("HttpService").JSONDecode, game:GetService("HttpService"), Result) --> Decodes it from Json to a Lua array.
if success2 then
if result2 then
for _, outfitItem in ipairs(result2.data) do
if not outfitItem["isEditable"] then continue end --> Ensures its not an official Roblox bundle.
task.wait(0.1)
table.insert(Outfits, outfitItem)
end
end
else
warn(result2)
end
end
else
warn(Result)
end
end
return Outfits
end
local PlayerOutfits = GetPlayerOutfits(851917460) --> Replace number with ID