Miscellaneous

GetObjects

Loads a local Roblox asset and returns a one-item table containing the loaded Instance.

Syntax

GetObjects(context: DataModel, asset: string): { Instance }

Argumente

NameTypBeschreibung
contextDataModelMethod-call self value. Use game:GetObjects(asset).
assetstringAsset string passed to Roblox local asset loading.

Rückgaben

NameTypBeschreibung
objects{ Instance }Table whose first element is the loaded Instance.

Beschreibung

Loads a local Roblox asset and returns a one-item table containing the loaded Instance. Use the method-call form game:GetObjects(asset).

Rufe es mit 2 Parameter(n) auf: context, asset. Die Argumenttabelle erklärt, welche Werte erforderlich sind und welche nur das Verhalten verfeinern.

Es gibt objects ({ Instance }) zurück. Nutze die Rückgabetabelle, um erfolgreiche Werte von nil-Ergebnissen und behandelbaren Fehlern zu trennen.

Beispiel

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