PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetFreeDecals

The GetFreeDecals function retrieves a list of Free Decals from the Catalog. The return type for this method is very odd, as it returns a single table wrapped in a table.

The best way to explain it is to show a visual of the array returned:

[1] = {
	CurrentStartIndex = 1; -- This can vary depending on the page you input.
	TotalCount = 21; -- Always 21.
	Results = {
		-- All parameters here are psuedo. They can vary depending on the asset.
		[1] = {	
			Name = "Asset Name"; 
			AssetId = 0000000;
			AssetVersionId = 0000000;
			CreatorName = "Roblox";
		},
		-- [2], [3], and so on... up to [21]
	},
}

Yikes! That quite confusing. Unfortunately this method was added in the earlier days of Roblox, where easy to understand return-types weren’t a priority.

Thankfully, an example for iterating over this list has been provided at the bottom of this page.

Additionally, if you want to insert Model|Models instead, you can use the InsertService/GetFreeModels function.

Note: The page argument starts at 0. So Page 1 = 0, Page 2 = 1, etc.

Parameters

Name Type Default Description

String used to search for free decals in the Catalog

int

The page number in the Catalog to return

Returns

Return Type Summary

A single table (of returned free decals) wrapped in a table


Code Samples


InsertService:GetFreeDecals

local insertService = game:GetService("InsertService")
local page = unpack(insertService:GetFreeDecals("Cats",0)) -- Search for "Cats" on Page 1.

for i = 1,page.TotalCount do
	local item = page.Results[i]
	print("Item #"..i)
	for key,value in pairs(item) do
		print(" " .. key .. ": " .. value)
	end
end