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

GetFreeModels

The GetFreeModels function retrieves a list of Free Models 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]
		};
	};
}

An example for iterating over this list has been provided at the bottom of this page.

Additionally, if you would like to insert free Decals, you can use the InsertService/GetFreeDecals function.

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 models) wrapped in a table.


Code Samples


InsertService:GetFreeModels

local insertService = game:GetService("InsertService")
local page = unpack(insertService:GetFreeModels("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