Syntax
GetObjects(context: DataModel, asset: string): { Instance }Arguments
| Name | Type | Description |
|---|---|---|
context | DataModel | Method-call self value. Use game:GetObjects(asset). |
asset | string | Asset string passed to Roblox local asset loading. |
Returns
| Name | Type | Description |
|---|---|---|
objects | { Instance } | Table whose first element is the loaded Instance. |
Description
Loads a local Roblox asset and returns a one-item table containing the loaded Instance. Use the method-call form game:GetObjects(asset).
Call it with 2 parameter(s): context, asset. The argument table explains which values are required and which ones only refine the behavior.
It returns objects ({ Instance }). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Load a local asset through Roblox local asset loading and return it in a one-item table.
local objects = game:GetObjects("rbxassetid://123456789")
local object = objects[1]
if object then
print(object.Name)
end