Skip to main content

Script.GetComponent(userdata type)

Returns the component of Type type if the game object has one attached, null if it doesn't.

Parameters:

NameTypeDescription
typeuserdataThe type of Component to retrieve.

Returns:

typeDescription
Componentcomponent of Type

Usage

---@type Script
local script;

---@type userdata
local type;


local val0 = script.GetComponent(type)