GetComponent
7/14/25Less than 1 minute
Script.GetComponent(userdata type)
Returns the component of Type type if the game object has one attached, null if it doesn't.
Parameters:
| Name | Type | Description |
|---|---|---|
| type | userdata | The type of Component to retrieve. |
Returns:
| type | Description |
|---|---|
| Component | component of Type |
Usage
---@type Script
local script;
---@type userdata
local type;
local val0 = script.GetComponent(type)
