Skip to main content

SDKGrab.TryGetComponent(TComponent type)

Gets the component of the specified type, if it exists.

Parameters:

NameTypeDescription
typeTComponentThe type of the component to retrieve.

Returns:

typeDescription
booleanReturns true if the component is found, false otherwise.
TComponentThe output argument that will contain the component or nil.

Usage

---@type SDKGrab
local sdkgrab;

---@type TComponent
local type;


local val0, val1 = sdkgrab.TryGetComponent(type)

Example

exists, component = myComponent.TryGetComponent(Transform);
-- exists is a boolean
-- component is Component or nil