Hello, I’m writing to ask how I can get the ID of a Marketplace accessory by typing their exact case-sensitive name.
Here an example of how it should work: 1). Player types the case-sensitive name of the accessory in a TextBox. 2). Player clicks on a TextButton after typing the name in. 3). A TextLabel’s text changes to the ID of the accessory typed in.
I don’t mean for anyone to send a full script or spoonfeed but to just send a simple example.
im too lazy to find a roblox function to do this so heres a quick rundown on how you can do it with catalog api:
keyword = "Inferno Diadem" -- What you want to search for
https = game:GetService("HttpService"):GetAsync("https://catalog.roproxy.com/v1/search/items/details?category=11&Keyword=".. keyword)
-- Using the catalog API V1 to search for the item
luatable = game:GetService("HttpService"):JSONDecode(https) -- Turn JSON to a understandable lua table
answer = luatable["data"][1]["id"] -- getting the first item that appeared in data, then getting its id.
print(answer) -- 14483982369
now, this version might be a little unsafe since if you write nonsense, it will spit out random hats (or just does it no matter what), so if i have the time i will probably update this
and update i did.
keyword = "Inferno Diadem" -- What you want to search for
https = game:GetService("HttpService"):GetAsync("https://catalog.roproxy.com/v1/search/items/details?category=11&Keyword=".. keyword)
-- Using the catalog API V1 to search for the item
luatable = game:GetService("HttpService"):JSONDecode(https) -- Turn JSON to a understandable lua table
answer = false
for i,v in ipairs(luatable["data"]) do
if v["name"] == keyword then
answer = v["id"]
end
end
if answer ~= false then
print("ID: ".. answer) -- ID: 14483982369
else
print("Couldnt find an accessory named ".. keyword) -- Couldnt find an accessory named Inferno Diadem
end
note that i am not going to provide the rest, just wanting to give you a piece you can use to make your dreams.