getobjects Asynchronous

Load Instances from an asset URL through the DataModel’s GetObjects method. Use it when your script needs the objects inside an asset rather than only its ID.

Syntax
Luau
getobjects(asset: string) -> {Instance}

getobjects(game: DataModel, asset: string) -> {Instance}

Parameters · overload 1

Function parameters
ParameterTypeDescription
assetstringAsset URL or identifier accepted by game:GetObjects.

Parameters · overload 2

Function parameters
ParameterTypeDescription
gameDataModelDataModel receiver for the alternate game-first call form.
assetstringAsset URL or identifier accepted by game:GetObjects.

Returns

{Instance}

An array of loaded Instances; inspect and parent or destroy them yourself.

Usage notes

The wrapper delegates to the host method. Loading can fail, so handle errors and only use asset IDs you intend to load.

Example

Example
Luau
-- Replace this with an asset ID you own or trust.
local asset = "rbxassetid://YOUR_ASSET_ID"
local ok, objects = pcall(getobjects, asset)
if ok then
    for _, object in ipairs(objects) do
        print(object.ClassName, object.Name)
        object:Destroy()
    end
else
    print("Asset could not be loaded:", objects)
end
Kawaii documentation