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