DecalFinder
Efficient Decal Search for Roblox Developers
DecalFinder is a fast, open-source tool for searching and retrieving Roblox decals. It utilizes Roproxy to request images from the Roblox toolbox from text, allowing you more flexibility for your scripts and users when finding images.
Functionality
- Search Decals: Search the Roblox decal toolbox, returning a list of decals based on a search text.
- Flexible Results: Retrieve as many decals as needed, with the option to return only the latest or most relevant results.
- Optimized: Fetch hundreds of decals very quickly, perfect for large-scale projects.
Usage
Call the searchDecals
function with the following parameters:
local module = require(game.ServerScriptService.DecalFinder) -- path to module
local decals = module.searchDecals("nature", 200, 100) -- Fetch up to 200, return last 100
Parameters
-
query
(string): The search keyword (e.g., “nature”). -
fetchLimit
(number, optional): Total decals fetched. default: 100). -
returnLimit
(number, optional): fetchLimit = Cuts the fetched data on the end based on this.(default: 100).
The returnLimit and fetchLimit are intended to allow you to dynamically fetch more content when users do things such as continue scrolling. If you want it to always return all the fetched images, simply make fetchLimit and returnLimit the same
Example Code
local decals = module.searchDecals("space", 200, 50) -- Search for 200 decals, return the last 50
for _, decal in ipairs(decals) do
print(decal.name, decal.imageUrl)
end
Why Use It?
- Performance: Retrieves large numbers of decals quickly.
- Customization: Adjustable parameters for your specific needs.
- Open-Source: Fully customizable and free to use.
Copy the Module
local module = {}
local HttpService = game:GetService("HttpService")
local SEARCH_URL = "https://apis.roproxy.com/toolbox-service/v1/marketplace/13?limit=%d&keyword=%s&includeOnlyVerifiedCreators=true&offset=0"
local IMAGE_URL_TEMPLATE = "https://www.roblox.com/asset-thumbnail/image?assetId=%d&width=420&height=420&format=png"
function module.searchDecals(query, fetchLimit, returnLimit)
fetchLimit = fetchLimit or 100 -- Default to 100 if not specified
returnLimit = returnLimit or 100 -- Default to 100 if not specified
-- Fetch the requested number of decals
local url = string.format(SEARCH_URL, fetchLimit, HttpService:UrlEncode(query))
local success, response = pcall(HttpService.GetAsync, HttpService, url)
if not success then
warn("Failed to retrieve decals:", response)
return {}
end
local data = HttpService:JSONDecode(response)
if not data or not data.data then
warn("Invalid response structure")
return {}
end
local decals = {}
for _, asset in ipairs(data.data) do
table.insert(decals, {
id = asset.id,
name = asset.name or "Unknown",
imageUrl = string.format(IMAGE_URL_TEMPLATE, asset.id)
})
end
-- Return only the last `returnLimit` items (or fewer if not enough exist)
local startIndex = math.max(1, #decals - (returnLimit - 1))
return { unpack(decals, startIndex, #decals) }
end
return module
–
Hope you guys enjoy!