I am talking about these attributes, which are visible on the site, I want the players of my game to be able to insert gears, but not all gears? Is there even a way for me to get gear Attributes using a script?
local http = game:GetService("HttpService")
local marketplace = game:GetService("MarketplaceService")
local baseUrl = "https://www.roproxy.com/catalog/%d/%s"
local function getGearAttribute(gearId, gearName)
gearName = gearName:gsub("%s", "-")
local gearUrl = baseUrl:format(gearId, gearName)
local success, result = pcall(function()
return http:GetAsync(gearUrl)
end)
if success then
if result then
local gearAttribute = result:match("icon%-(%w+%s?%w+)%sattribute%-icon")
return gearAttribute
end
else
warn(result)
end
end
local function getProductInfo(productId)
local success, result = pcall(function()
return marketplace:GetProductInfo(productId)
end)
if success then
if result then
if result.AssetTypeId == 19 then
return getGearAttribute(productId, result.Name)
end
end
else
warn(result)
end
end
local gearId = 11563251
local gearAttribute = getProductInfo(gearId)
print(gearAttribute) --Explosive.
Here you go, I just wrote this script which gets a gear’s attribute.
local http = game:GetService("HttpService")
local marketplace = game:GetService("MarketplaceService")
local baseUrl = "https://www.roproxy.com/catalog/%d/%s"
local function getGearAttributes(gearId, gearName)
gearName = gearName:gsub("%s", "-")
local gearUrl = baseUrl:format(gearId, gearName)
local success, result = pcall(function()
return http:GetAsync(gearUrl)
end)
if success then
if result then
local gearAttributes = {}
for gearAttribute in result:gmatch("icon%-(%w+)%sattribute%-icon") do
table.insert(gearAttributes, gearAttribute)
end
return gearAttributes
end
else
warn(result)
end
end
local function getProductInfo(productId)
local success, result = pcall(function()
return marketplace:GetProductInfo(productId)
end)
if success then
if result then
if result.AssetTypeId == 19 then
return getGearAttributes(productId, result.Name)
end
end
else
warn(result)
end
end
local gearId = 15932306
local gearAttributes = getProductInfo(gearId)
print(table.concat(gearAttributes, " ")) --Explosive PowerUp.
Just decided to write a second implementation which supports gears with multiple attributes.