# Model

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

- Inherits from, nearest first: [PVInstance](https://rapi.sleaze.dev/classes/PVInstance.md), [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Subclasses: [Actor](https://rapi.sleaze.dev/classes/Actor.md), [BackpackItem](https://rapi.sleaze.dev/classes/BackpackItem.md), [ProceduralModel](https://rapi.sleaze.dev/classes/ProceduralModel.md), [Status](https://rapi.sleaze.dev/classes/Status.md), [WorldRoot](https://rapi.sleaze.dev/classes/WorldRoot.md)
- Memory category: BaseParts
- HTML page: https://rapi.sleaze.dev/classes/Model/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/Model

Models are container objects, meaning they group objects together. They are best used to hold collections of `BaseParts` and have a number of functions that extend their functionality.

## Properties

### LevelOfDetail

```luau
Model.LevelOfDetail: Enum.ModelLevelOfDetail = Enum.ModelLevelOfDetail.Automatic
```

- Tags: Capabilities: PluginOrOpenCloud

Sets the level of detail on the model for experiences with instance streaming enabled.

### ModelStreamingMode

```luau
Model.ModelStreamingMode: Enum.ModelStreamingMode = Enum.ModelStreamingMode.Default
```

Controls the model streaming behavior on `Models` when instance streaming is enabled.

### LodEntity

```luau
Model.LodEntity: LodDataEntity
```

- Tags: Hidden, Not scriptable

### ModelMeshCFrame

```luau
Model.ModelMeshCFrame: CFrame = CFrame.identity
```

- Tags: Hidden, Not scriptable

### ModelMeshData

```luau
Model.ModelMeshData: SharedString
```

- Tags: Hidden, Not scriptable

### ModelMeshSize

```luau
Model.ModelMeshSize: Vector3 = Vector3.zero
```

- Tags: Hidden, Not scriptable

### NeedsPivotMigration

```luau
Model.NeedsPivotMigration: boolean = false
```

- Tags: Hidden, Not replicated, Not scriptable

### SlimAnimationTarget

```luau
Model.SlimAnimationTarget: SlimAnimationDataEntity
```

- Tags: Hidden, Not scriptable

### SlimHash

```luau
Model.SlimHash: SharedString
```

- Tags: Hidden, Not scriptable, Roblox engine security

### PrimaryPart

```luau
Model.PrimaryPart: BasePart
```

The primary part of the [`Model`](https://rapi.sleaze.dev/classes/Model.md), or `nil` if not explicitly set.

### Scale

```luau
Model.Scale: number = 1
```

- Tags: Not replicated, Not scriptable

Editor-only property used to scale the model around its pivot. Setting this property will move the scale as though [`Model:ScaleTo()`](https://rapi.sleaze.dev/classes/Model.md) was called on it.

### ScaleFactor

```luau
Model.ScaleFactor: number = 1
```

- Tags: Hidden, Not scriptable

### WorldPivot

```luau
Model.WorldPivot: CFrame = CFrame.identity
```

- Tags: Not replicated

Determines where the pivot of a [`Model`](https://rapi.sleaze.dev/classes/Model.md) which does **not** have a set [`Model.PrimaryPart`](https://rapi.sleaze.dev/classes/Model.md) is located.

### WorldPivotData

```luau
Model.WorldPivotData: CFrame?
```

- Tags: Hidden, Not scriptable

## Methods

### AddPersistentPlayer

```luau
Model:AddPersistentPlayer(playerInstance: Player? = nil)
```

Sets this model to be persistent for the specified player. [`ModelStreamingMode`](https://rapi.sleaze.dev/classes/Model.md) must be set to `PersistentPerPlayer` for behavior to be changed as a result of addition.

Parameters:

- `playerInstance`: The [`Player`](https://rapi.sleaze.dev/classes/Player.md) to make this model persistent for.

### GetBoundingBox

```luau
Model:GetBoundingBox(): (CFrame, Vector3)
```

Returns a description of a volume that contains all parts of a Model.

Returns: A [`CFrame`](https://rapi.sleaze.dev/index/types/CFrame.md) representing the orientation of the volume followed by a [`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md) representing the size of the volume.

### GetExtentsSize

```luau
Model:GetExtentsSize(): Vector3
```

Returns the size of the smallest bounding box that contains all of the `BaseParts` in the [`Model`](https://rapi.sleaze.dev/classes/Model.md), aligned with the [`Model.PrimaryPart`](https://rapi.sleaze.dev/classes/Model.md) if it is set.

Returns: The [`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md) extents size of the [`Model`](https://rapi.sleaze.dev/classes/Model.md).

### GetPersistentPlayers

```luau
Model:GetPersistentPlayers(): { Instance }
```

Returns all the [`Player`](https://rapi.sleaze.dev/classes/Player.md) objects that this model object is persistent for. Behavior varies based on whether this method is called from a [`Script`](https://rapi.sleaze.dev/classes/Script.md) or a [`LocalScript`](https://rapi.sleaze.dev/classes/LocalScript.md).

Returns: A table with all the [`Player`](https://rapi.sleaze.dev/classes/Player.md) objects that this model object is persistent for.

### GetScale

```luau
Model:GetScale(): number
```

- Tags: Simulation access

Returns the canonical scale of the model, which defaults to 1 for newly created models and will change as it is scaled via [`Model:ScaleTo()`](https://rapi.sleaze.dev/classes/Model.md).

Returns: The current canonical scale factor of the model.

### MoveTo

```luau
Model:MoveTo(position: Vector3)
```

Moves the [`PrimaryPart`](https://rapi.sleaze.dev/classes/Model.md) to the given position. If a primary part has not been specified, the root part of the model will be used.

Parameters:

- `position`: The [`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md) the [`Model`](https://rapi.sleaze.dev/classes/Model.md) is moved to.

### RemovePersistentPlayer

```luau
Model:RemovePersistentPlayer(playerInstance: Player? = nil)
```

Makes this model no longer persistent for the specified player. [`ModelStreamingMode`](https://rapi.sleaze.dev/classes/Model.md) must be set to `PersistentPerPlayer` for behavior to be changed as a result of removal.

Parameters:

- `playerInstance`: The [`Player`](https://rapi.sleaze.dev/classes/Player.md) to make this model no longer persistent for.

### ScaleTo

```luau
Model:ScaleTo(newScaleFactor: number)
```

Sets the scale factor of the model, adjusting the sizing and location of all descendant Instances such that they have that scale factor relative to their initial sizes and locations when scale factor was 1.

Parameters:

- `newScaleFactor`: The new scale factor for the model, which must be a positive non-zero number. A value of 1 represents the model's original size.

### TranslateBy

```luau
Model:TranslateBy(delta: Vector3)
```

Shifts a [`Model`](https://rapi.sleaze.dev/classes/Model.md) by the given [`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md) offset, preserving the model's orientation. If another [`BasePart`](https://rapi.sleaze.dev/classes/BasePart.md) or [`Terrain`](https://rapi.sleaze.dev/classes/Terrain.md) already exists at the new position then the [`Model`](https://rapi.sleaze.dev/classes/Model.md) will overlap said object.

Parameters:

- `delta`: The [`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md) to translate the [`Model`](https://rapi.sleaze.dev/classes/Model.md) by.

### BreakJoints

```luau
Model:BreakJoints()
```

- Tags: Deprecated

**Deprecated:**

Breaks connections between `BaseParts`, including surface connections with any adjacent parts, `WeldConstraints` and all `Welds` and other `JointInstances`.

### GetModelCFrame

```luau
Model:GetModelCFrame(): CFrame
```

- Tags: Deprecated
- Use instead: [`Model.GetPrimaryPartCFrame`](https://rapi.sleaze.dev/classes/Model.md)

**Deprecated:** This function has been deprecated as it did not provide reliable results. You can instead use [`Model:GetPrimaryPartCFrame()`](https://rapi.sleaze.dev/classes/Model.md) to retrieve the [`CFrame`](https://rapi.sleaze.dev/index/types/CFrame.md) of the model's primary part.

This value historically returned the CFrame of a central position in the model.

Returns: A [`CFrame`](https://rapi.sleaze.dev/index/types/CFrame.md) representing a central position in the model.

### GetModelSize

```luau
Model:GetModelSize(): Vector3
```

- Tags: Deprecated
- Use instead: [`Model.GetExtentsSize`](https://rapi.sleaze.dev/classes/Model.md)

**Deprecated:** This item is deprecated. Do not use it for new work. Developers can instead use [`Model.GetExtentsSize`](https://rapi.sleaze.dev/classes/Model.md).

Returns the Vector3 size of the Model.

Returns: The [`Vector3`](https://rapi.sleaze.dev/index/types/Vector3.md) size of the [`Model`](https://rapi.sleaze.dev/classes/Model.md).

### GetPrimaryPartCFrame

```luau
Model:GetPrimaryPartCFrame(): CFrame
```

- Tags: Deprecated
- Use instead: [`PVInstance.GetPivot`](https://rapi.sleaze.dev/classes/PVInstance.md)

**Deprecated:**

Returns the [`CFrame`](https://rapi.sleaze.dev/index/types/CFrame.md) of the model's [`Model.PrimaryPart`](https://rapi.sleaze.dev/classes/Model.md). This function will throw an error if no primary part exists for the [`Model`](https://rapi.sleaze.dev/classes/Model.md).

Returns: The [`CFrame`](https://rapi.sleaze.dev/index/types/CFrame.md) of the model's [`Model.PrimaryPart`](https://rapi.sleaze.dev/classes/Model.md).

### MakeJoints

```luau
Model:MakeJoints()
```

- Tags: Deprecated

**Deprecated:** This joint type has been deprecated. Don't use it for new work. Use `WeldConstraints` and `HingeConstraints` instead.

Goes through all `BaseParts` in the [`Model`](https://rapi.sleaze.dev/classes/Model.md). If any part's side has a SurfaceType that can make a joint it will create a joint with any adjacent parts.

### ResetOrientationToIdentity

```luau
Model:ResetOrientationToIdentity()
```

- Tags: Deprecated
- Use instead: [`Model.SetPrimaryPartCFrame`](https://rapi.sleaze.dev/classes/Model.md)

**Deprecated:** This function has been deprecated; it remains to prevent legacy scripts from throwing errors, but it does nothing when called.

Resets the rotation of the model's parts to the previously set identity rotation, which is done through the [`Model:SetIdentityOrientation()`](https://rapi.sleaze.dev/classes/Model.md) method.

### SetIdentityOrientation

```luau
Model:SetIdentityOrientation()
```

- Tags: Deprecated
- Use instead: [`Model.SetPrimaryPartCFrame`](https://rapi.sleaze.dev/classes/Model.md)

**Deprecated:** This function has been deprecated; it remains to prevent legacy scripts from throwing errors, but it does nothing when called.

Sets the identity rotation of the given model, allowing you to reset the rotation of the entire model later, through the use of the [`ResetOrientationToIdentity`](https://rapi.sleaze.dev/classes/Model.md) method.

### SetPrimaryPartCFrame

```luau
Model:SetPrimaryPartCFrame(cframe: CFrame)
```

- Tags: Deprecated
- Use instead: [`PVInstance.PivotTo`](https://rapi.sleaze.dev/classes/PVInstance.md)

**Deprecated:**

Sets the [`BasePart.CFrame`](https://rapi.sleaze.dev/classes/BasePart.md) of the model's [`Model.PrimaryPart`](https://rapi.sleaze.dev/classes/Model.md). All other parts in the model will also be moved and will maintain their orientation and offset respective to the [`Model.PrimaryPart`](https://rapi.sleaze.dev/classes/Model.md).

Parameters:

- `cframe`: The [`CFrame`](https://rapi.sleaze.dev/index/types/CFrame.md) to be set.

### breakJoints

```luau
Model:breakJoints()
```

- Tags: Deprecated
- Use instead: [`Model.BreakJoints`](https://rapi.sleaze.dev/classes/Model.md)

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

### makeJoints

```luau
Model:makeJoints()
```

- Tags: Deprecated
- Use instead: [`Model.MakeJoints`](https://rapi.sleaze.dev/classes/Model.md)

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

### move

```luau
Model:move(location: Vector3)
```

- Tags: Deprecated
- Use instead: [`Model.MoveTo`](https://rapi.sleaze.dev/classes/Model.md)

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

### moveTo

```luau
Model:moveTo(location: Vector3)
```

- Tags: Deprecated
- Use instead: [`Model.MoveTo`](https://rapi.sleaze.dev/classes/Model.md)

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

## Inherited members

- From [PVInstance](https://rapi.sleaze.dev/classes/PVInstance.md): `Pivot Offset`, `Origin`, `GetPivot`, `PivotTo`
- 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`
