Syntax
GetObjects(context: DataModel, asset: string): { Instance }Argumente
| Name | Typ | Beschreibung |
|---|---|---|
context | DataModel | Method-call self value. Use game:GetObjects(asset). |
asset | string | Asset string passed to Roblox local asset loading. |
Rückgaben
| Name | Typ | Beschreibung |
|---|---|---|
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