# InsertService

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/InsertService/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/InsertService

Used to insert assets from the Roblox website.

## Properties

### AllowInsertFreeModels

```luau
InsertService.AllowInsertFreeModels: boolean = false
```

- Tags: Deprecated, Not browsable, Not replicated, Capabilities: LoadUnownedAsset

**Deprecated:** This item was never released. Do not use it in new work.

Indicates whether ''Free Models'' can be inserted into the game.

## Methods

### CreateMeshPartAsync

```luau
InsertService:CreateMeshPartAsync(meshId: string, collisionFidelity: Enum.CollisionFidelity, renderFidelity: Enum.RenderFidelity): MeshPart
```

- Tags: Yields, Capabilities: Basic

Creates a new [`MeshPart`](https://rapi.sleaze.dev/classes/MeshPart.md) with specified fidelity values.

Parameters:

- `meshId`: Mesh asset ID.
- `collisionFidelity`: Set [`MeshPart.CollisionFidelity`](https://rapi.sleaze.dev/classes/TriangleMeshPart.md).
- `renderFidelity`: Set [`MeshPart.RenderFidelity`](https://rapi.sleaze.dev/classes/MeshPart.md).

Returns: New [`MeshPart`](https://rapi.sleaze.dev/classes/MeshPart.md) instance.

### GetFreeDecalsAsync

```luau
InsertService:GetFreeDecalsAsync(searchText: string, pageNum: number): { any }
```

- Tags: Yields, Capabilities: AssetRead

Retrieves a list of free Decals from the Catalog.

Parameters:

- `searchText`: String used to search for free decals in the Catalog.
- `pageNum`: The page number in the Catalog to return.

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

### GetFreeModelsAsync

```luau
InsertService:GetFreeModelsAsync(searchText: string, pageNum: number): { any }
```

- Tags: Yields, Capabilities: AssetRead

Retrieves a list of Free Models from the Catalog.

Parameters:

- `searchText`: String used to search for free decals in the Catalog.
- `pageNum`: The page number in the Catalog to return.

Returns: A single table (of returned free models) wrapped in a table.

### GetLatestAssetVersionAsync

```luau
InsertService:GetLatestAssetVersionAsync(assetId: number): number
```

- Tags: Yields, Capabilities: AssetRead

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

Parameters:

- `assetId`: The ID of the asset to retrieve the latest version for.

Returns: The latest asset version ID for the specified asset.

### GetLocalFileContents

```luau
InsertService:GetLocalFileContents(contentId: string): string
```

- Tags: Roblox script security

### LoadAsset

```luau
InsertService:LoadAsset(assetId: number): Instance
```

- Tags: Yields, Capabilities: LoadOwnedAsset

Returns a [`Model`](https://rapi.sleaze.dev/classes/Model.md) containing the asset.

Parameters:

- `assetId`: The asset ID of the asset being loaded.

Returns: An instance of the loaded asset.

### LoadAssetVersion

```luau
InsertService:LoadAssetVersion(assetVersionId: number): Instance
```

- Tags: Yields, Capabilities: LoadOwnedAsset

Returns a model inserted into [`InsertService`](https://rapi.sleaze.dev/classes/InsertService.md) containing the asset with the given assetVersionId.

Parameters:

- `assetVersionId`: The version ID of the asset to load.

Returns: A [`Model`](https://rapi.sleaze.dev/classes/Model.md) containing the asset at the specified version.

### LoadAssetWithBytecodeAsync

```luau
InsertService:LoadAssetWithBytecodeAsync(content: Content): Instance
```

- Tags: Yields, Roblox script security

### LoadAssetWithFormat

```luau
InsertService:LoadAssetWithFormat(assetId: number, format: string): { Instance }
```

- Tags: Yields, Roblox script security

### LoadLocalAsset

```luau
InsertService:LoadLocalAsset(assetPath: string): Instance
```

- Tags: Roblox script security

### LoadPackageAssetAsync

```luau
InsertService:LoadPackageAssetAsync(url: string): { Instance }
```

- Tags: Yields, Roblox script security

### ApproveAssetId

```luau
InsertService:ApproveAssetId(assetId: number)
```

- Tags: Deprecated

**Deprecated:** This item is deprecated. Do not use it for new work.

Deprecated. Accepts an asset ID for InsertService approval; calling it has no effect.

Parameters:

- `assetId`: The ID of the asset.

### ApproveAssetVersionId

```luau
InsertService:ApproveAssetVersionId(assetVersionId: number)
```

- Tags: Deprecated

**Deprecated:** This item is deprecated. Do not use it for new work.

Deprecated. Accepts an asset version ID for InsertService approval; calling it has no effect.

Parameters:

- `assetVersionId`: The version ID of the asset.

### GetBaseCategories

```luau
InsertService:GetBaseCategories(): { any }
```

- Tags: Deprecated, Yields
- Use instead: [`InsertService.GetBaseSets`](https://rapi.sleaze.dev/classes/InsertService.md)

**Deprecated:** This item is deprecated. Do not use it for new work.

### GetBaseSets

```luau
InsertService:GetBaseSets(): { any }
```

- Tags: Deprecated, Yields

**Deprecated:** [Sets have been removed](https://devforum.roblox.com/t/sunsetting-sets/189402) from Roblox.

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

Returns: An array of dictionaries containing information about Roblox-approved sets.

### GetCollection

```luau
InsertService:GetCollection(categoryId: number): { any }
```

- Tags: Deprecated, Yields

**Deprecated:** [Sets have been removed](https://devforum.roblox.com/t/sunsetting-sets/189402) from Roblox.

Returns the most recently uploaded models in the specified category.

Parameters:

- `categoryId`: The ID of the set (category) to retrieve models from.

Returns: An array of the most recently uploaded models in the specified set.

### GetFreeDecals

```luau
InsertService:GetFreeDecals(searchText: string, pageNum: number): { any }
```

- Tags: Deprecated, Yields, Capabilities: AssetRead
- Use instead: [`InsertService.GetFreeDecalsAsync`](https://rapi.sleaze.dev/classes/InsertService.md)

**Deprecated:** Use [`GetFreeDecalsAsync()`](https://rapi.sleaze.dev/classes/InsertService.md) instead.

Retrieves a list of free Decals from the Catalog.

Parameters:

- `searchText`: String used to search for free decals in the Catalog.
- `pageNum`: The page number in the Catalog to return.

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

### GetFreeModels

```luau
InsertService:GetFreeModels(searchText: string, pageNum: number): { any }
```

- Tags: Deprecated, Yields, Capabilities: AssetRead
- Use instead: [`InsertService.GetFreeModelsAsync`](https://rapi.sleaze.dev/classes/InsertService.md)

**Deprecated:** Use [`GetFreeModelsAsync()`](https://rapi.sleaze.dev/classes/InsertService.md) instead.

Retrieves a list of Free Models from the Catalog.

Parameters:

- `searchText`: String used to search for free models in the Catalog.
- `pageNum`: The page number in the Catalog to return.

Returns: A single table (of returned free models) wrapped in a table.

### GetUserCategories

```luau
InsertService:GetUserCategories(userId: User): { any }
```

- Tags: Deprecated, Yields
- Use instead: [`InsertService.GetUserSets`](https://rapi.sleaze.dev/classes/InsertService.md)

**Deprecated:** This item is deprecated. Do not use it for new work.

### GetUserSets

```luau
InsertService:GetUserSets(userId: User): { any }
```

- Tags: Deprecated, Yields

**Deprecated:** [Sets have been removed](https://devforum.roblox.com/t/sunsetting-sets/189402) from Roblox.

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

Parameters:

- `userId`: The ID of the user whose sets to retrieve.

Returns: An array of dictionaries containing information about the user's sets.

### Insert

```luau
InsertService:Insert(instance: Instance)
```

- Tags: Deprecated

**Deprecated:** This function has been superseded by [`InsertService:LoadAsset()`](https://rapi.sleaze.dev/classes/InsertService.md) which should be used in all new work.

Inserts [`Instance`](https://rapi.sleaze.dev/classes/Instance.md) into [`Workspace`](https://rapi.sleaze.dev/classes/Workspace.md).

Parameters:

- `instance`: The [`Instance`](https://rapi.sleaze.dev/classes/Instance.md) to insert into [`Workspace`](https://rapi.sleaze.dev/classes/Workspace.md).

### loadAsset

```luau
InsertService:loadAsset(assetId: number): Instance
```

- Tags: Deprecated, Yields, Capabilities: LoadOwnedAsset
- Use instead: [`InsertService.LoadAsset`](https://rapi.sleaze.dev/classes/InsertService.md)

**Deprecated:** This function is a deprecated variant of [`InsertService:LoadAsset()`](https://rapi.sleaze.dev/classes/InsertService.md) which should be used instead.

## Events

### InternalDelete

```luau
InsertService.InternalDelete: RBXScriptSignal<(instance: Instance)>
```

- Tags: Hidden, Capabilities: AssetCreateUpdate

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
