Instances
Model
Groups instances and provides model-level visibility, collision, pivot and uniform scaling controls.
Properties
| Name | Type | Description |
|---|---|---|
Name | string | Model name. |
Parent | Instance | Where the Model sits in the hierarchy. |
Visible | boolean | When false, descendant BaseParts are not rendered. Default: true. |
CanCollide | boolean | When false, descendant BaseParts do not participate in collision. Default: true. |
Scale | number | Current uniform Model scale. Default: 1. Setting Scale scales descendant BaseParts around the Model pivot. |
Visible and CanCollide act on descendants without changing the descendants' own Transparency or CanCollide values.
A descendant BasePart is visible or collidable only when its own properties and every containing Model or Folder allow that behavior.
Model methods
| Name | Type | Description |
|---|---|---|
GetPivot() | CFrame | Returns the Model's current pivot. |
PivotTo(cframe) | method | Moves and rotates descendant BaseParts around the Model pivot. |
ScaleTo(scale) | method | Sets the Model to an absolute uniform scale around its pivot. |
GetScale() | number | Returns the Model's current uniform scale. |
GetBoundingBox() | CFrame, Vector3 | Returns the pivot-oriented bounding-box CFrame and size of all descendant BaseParts. |
GetChildren() | table | Returns direct child instances. |
GetDescendants() | table | Returns all descendants. |
How the pivot is chosen
If the Model has a direct child named Torso that is a BasePart, Glorpia uses it as the pivot. Otherwise it uses the first descendant BasePart it finds.
GetPivot(), PivotTo(), ScaleTo() and GetBoundingBox() require the Model to contain at least one BasePart.Example: Visibility and collision
Luau
local model = workspace:FindFirstChild("Building")
if model and model:IsA("Model") then
model.Visible = false
model.CanCollide = false
task.wait(1)
model.Visible = true
model.CanCollide = true
endExample: Move a grouped object
Luau
local model = workspace:FindFirstChild("MovingPlatform")
if model and model:IsA("Model") then
local current = model:GetPivot()
model:PivotTo(current + Vector3.new(0, 5, 0))
endExample: Scale and measure a Model
Luau
local model = workspace:FindFirstChild("Vehicle")
if model and model:IsA("Model") then
model:ScaleTo(1.5)
print(model:GetScale())
local boundsCFrame, boundsSize = model:GetBoundingBox()
print(boundsCFrame.Position, boundsSize)
endScaleTo() uses an absolute scale value. Calling ScaleTo(2) makes the Model twice its authored size regardless of its current scale.