Miscellaneous

GetObjects

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

構文

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

引数

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

戻り値

名前説明
objects{ Instance }Table whose first element is the loaded Instance.

説明

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

2 個のパラメータで呼び出します: context, asset。引数表では必須値と動作を調整する値を確認できます。

objects ({ Instance }) を返します。戻り値表を使って成功値、nil 結果、回復可能なエラーを分けて扱ってください。

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