Reference API Roblox

Engine API

Website

Related

Reference API Roblox

InsertService

Used to insert assets from the Roblox website.

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 23

HistoryMember
553AllowClientInsertModels: bool
553AllowInsertFreeModels: bool
573ApproveAssetId(assetId: int64): null
573ApproveAssetVersionId(assetVersionId: int64): null
645CreateMeshPartAsync(meshId: ContentId, collisionFidelity: CollisionFidelity, renderFidelity: RenderFidelity): MeshPart
553GetBaseCategories(): Array
603GetBaseSets(): Array
641GetCollection(categoryId: int64): Array
462GetFreeDecals(searchText: string, pageNum: int): Array
462GetFreeModels(searchText: string, pageNum: int): Array
462GetLatestAssetVersionAsync(assetId: int64): int64
567GetLocalFileContents(contentId: string): string
553GetUserCategories(userId: int64): Array
641GetUserSets(userId: int64): Array
573Insert(instance: Instance): null
462LoadAsset(assetId: int64): Instance
462LoadAssetVersion(assetVersionId: int64): Instance
648LoadAssetWithFormat(assetId: int64, format: string): Instances
462LoadLocalAsset(assetPath: string): Instance
648LoadPackageAsset(url: ContentId): Instances
648LoadPackageAssetAsync(url: ContentId): Instances
553loadAsset(assetId: int64): Instance
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Removed member index 11

HistoryMember
311SetAdvancedResults(enable: bool, user: bool = false): void
311SetAssetUrl(assetUrl: string): void
311SetAssetVersionUrl(assetVersionUrl: string): void
311SetBaseCategoryUrl(baseSetsUrl: string): void
311SetBaseSetsUrl(baseSetsUrl: string): void
311SetCollectionUrl(collectionUrl: string): void
311SetFreeDecalUrl(freeDecalUrl: string): void
311SetFreeModelUrl(freeModelUrl: string): void
311SetTrustLevel(trustLevel: float): void
311SetUserCategoryUrl(userSetsUrl: string): void
311SetUserSetsUrl(userSetsUrl: string): void

Description

InsertService is used to insert assets from the Roblox website, typically the LoadAsset function.

To load an asset, it must be accessible by the creator of the experience loading it, which can be either a user or group. Should an experience be uploaded by a different creator, the asset data would not be accessible. See the LoadAsset() method for more details on this security check. Note that you should not use this service for loading API keys or other secrets. Use HttpService:GetSecret() instead.

See Also

  • AssetService, which can provide information about assets you might want to load using InsertService

History 108

Members 23

AllowClientInsertModels

TypeDefault
boolfalse
This property is not scriptable. It cannot be accessed by script code.

History 4

Tags: [NotScriptable]

AllowInsertFreeModels

TypeDefault
boolfalse

The AllowInsertFreeModels property toggles whether ''Free Models'' can be inserted into the game, regardless of whether the place owner owns the asset.

This property is deprecated. It exists only for backward compatibility, and should not be used for new work.
This property is not replicated. Its interface does not cross the network boundary.
This property is not browsable. It is not visible in Studio's object browser.

History 5

Tags: [NotReplicated, NotBrowsable, Deprecated]

ApproveAssetId

Parameters (1)
assetIdint64
Returns (1)
null
This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 5

Tags: [Deprecated]

ApproveAssetVersionId

Parameters (1)
assetVersionIdint64
Returns (1)
null
This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 5

Tags: [Deprecated]

CreateMeshPartAsync

Parameters (3)
meshIdContentId
collisionFidelityCollisionFidelity
renderFidelityRenderFidelity
Returns (1)
MeshPart

Creates a new MeshPart with specified CollisionFidelity and RenderFidelity. Because MeshPart.MeshId is read only, this is the way to create a MeshPart through scripts without having to clone an existing one. It throws errors if creation fails.

This function yields. It will block the calling thread until completion.

History 7

Tags: [Yields]

GetBaseCategories

Parameters (0)
No parameters.
Returns (1)
Array
This function is deprecated. It exists only for backward compatibility, and should not be used for new work. GetBaseSets should be used instead.
This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields, Deprecated]

GetBaseSets

Parameters (0)
No parameters.
Returns (1)
Array

Returns an array of dictionaries, containing information about various Roblox approved sets.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.
This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields, Deprecated]

GetCollection

Parameters (1)
categoryIdint64
Returns (1)
Array

Returns the most recently uploaded models in the specified category.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.
This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields, Deprecated]

GetFreeDecals

Parameters (2)
searchTextstring
pageNumint
Returns (1)
Array

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
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[1] = {
	CurrentStartIndex = 1, -- This can vary depending on the page you input.
	TotalCount = 21, -- Always 21.
	Results = {
		-- All parameters here are pseudo. 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 want to insert Models instead, you can use the InsertService:GetFreeModels() function.

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

This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

GetFreeModels

Parameters (2)
searchTextstring
pageNumint
Returns (1)
Array

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
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[1] = {
	CurrentStartIndex = 1, -- This can vary depending on the page you input.
	TotalCount = 21, -- Always 21.
	Results = {
		-- All parameters here are pseudo. 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.

This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

GetLatestAssetVersionAsync

Parameters (1)
assetIdint64
Returns (1)
int64

Returns the latest AssetVersionId of an asset for assets created by the place creator. Can be used in combination with InsertService:LoadAssetVersion() to load the latest version of a model, even if it gets updated while the game is running.

This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields]

GetLocalFileContents

Parameters (1)
contentIdstring
Returns (1)
string

History 1

GetUserCategories

Parameters (1)
userIdint64
Returns (1)
Array
This function is deprecated. It exists only for backward compatibility, and should not be used for new work. GetUserSets should be used instead.
This function yields. It will block the calling thread until completion.

History 5

Tags: [Yields, Deprecated]

GetUserSets

Parameters (1)
userIdint64
Returns (1)
Array

Returns an array of dictionaries, containing information about sets owned by the user. This includes

  • Sets the user is subscribed to.
  • Sets that the user created.
  • A single set containing the models created by the user.
  • A single set containing the decals created by the user.

Note:

  • All values in the dictionaries are strings, even if they are a number.
NameDescription
NameThe name of the set.
DescriptionThe description of the set.
ImageAssetIdAn assetId for the icon of the set.
CreatorNameThe creator of the set.
AssetSetIdThe set's unique ID on the website.
CategoryIdIdentical to AssetSetId
SetTypeThe type of set that this set is.
This function is deprecated. It exists only for backward compatibility, and should not be used for new work.
This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields, Deprecated]

Insert

Parameters (1)
instanceInstance
Returns (1)
null

The Insert function is an ancient method used to insert an Instance into Workspace.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work.

History 4

Tags: [Deprecated]

LoadAsset

Parameters (1)
assetIdint64
Returns (1)
Instance

The LoadAsset function fetches an asset given its ID and returns a Model containing the asset. For example, to load this public Doge Model, which has the asset ID 257489726, you can use:

1
2
3
4
local assetId = 257489726
local InsertService = game:GetService("InsertService")
local model = InsertService:LoadAsset(assetId)
model.Parent = workspace

Calls to this function may fail if a server providing a model is having problems. As such, it's generally a good idea to wrap calls to this function in pcall to catch these kinds of errors.

1
2
3
4
5
6
7
8
9
local assetId = 257489726
local InsertService = game:GetService("InsertService")
local success, model = pcall(InsertService.LoadAsset, InsertService, assetId)
if success and model then
	print("Model loaded successfully")
	model.Parent = workspace
else
	print("Model failed to load!")
end

Security Check

An asset loaded by this function must be created or owned by either the game creator or Roblox. Additionally, benign asset types such as t-shirts, shirts, pants and avatar accessories are loadable from any game as they are public.

See also:

This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields]

LoadAssetVersion

Parameters (1)
assetVersionIdint64
Returns (1)
Instance

Returns a model inserted into InsertService containing the asset with the given assetVersionId.

This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields]

LoadAssetWithFormat

Parameters (2)
assetIdint64
formatstring
Returns (1)
Instances
This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

LoadLocalAsset

Parameters (1)
assetPathstring
Returns (1)
Instance

History 2

LoadPackageAsset

Parameters (1)
urlContentId
Returns (1)
Instances

History 4

LoadPackageAssetAsync

Parameters (1)
urlContentId
Returns (1)
Instances
This function yields. It will block the calling thread until completion.

History 6

Tags: [Yields]

loadAsset

Parameters (1)
assetIdint64
Returns (1)
Instance
This function is deprecated. It exists only for backward compatibility, and should not be used for new work. LoadAsset should be used instead.
This function yields. It will block the calling thread until completion.

History 4

Tags: [Yields, Deprecated]

Removed members 11

SetAdvancedResults

Parameters (2)Default
enablebool
userboolfalse
Returns (1)
void

History 2

SetAssetUrl

Parameters (1)
assetUrlstring
Returns (1)
void

History 2

SetAssetVersionUrl

Parameters (1)
assetVersionUrlstring
Returns (1)
void

History 2

SetBaseCategoryUrl

Parameters (1)
baseSetsUrlstring
Returns (1)
void

History 2

SetBaseSetsUrl

Parameters (1)
baseSetsUrlstring
Returns (1)
void

History 2

SetCollectionUrl

Parameters (1)
collectionUrlstring
Returns (1)
void

History 2

SetFreeDecalUrl

Parameters (1)
freeDecalUrlstring
Returns (1)
void

History 2

SetFreeModelUrl

Parameters (1)
freeModelUrlstring
Returns (1)
void

History 2

SetTrustLevel

Parameters (1)
trustLevelfloat
Returns (1)
void

History 2

SetUserCategoryUrl

Parameters (1)
userSetsUrlstring
Returns (1)
void

History 2

SetUserSetsUrl

Parameters (1)
userSetsUrlstring
Returns (1)
void

History 2

Settings