Skip to content
EnvironmentOverview

GetObjects

Represents loading of object resources.

Details#

Loads a local asset through InsertService and returns a one-element object array. The registered global expects a userdata receiver (normally game) followed by the content identifier: GetObjects(game, contentId). It does not automatically parent the loaded object. The example handles failure for an unavailable asset.

Examples#

Example

Luau
local ok, objects = pcall(GetObjects, game, "rbxassetid://0")
if ok then
    for _, object in ipairs(objects) do object:Destroy() end
else
    warn(objects)
end