Component
This item only works when running on the client. ClientThis item only works when running on the server. Server
This is the API Documentation for the Component module. Components add functionality to instances with the use of collection service tags.
Functions
new
Creates a new Component instance, this is used to add functionality to instances with the use of collection service tags.
tip
See the Boilerplates guide to get more component boilerplates.
Usage
local Example = {}
Example.__index = Example
Example.Name = "Example Component"
function Example.new(instance)end
function Example:Init()end
function Example:Destroy() end
local ExampleComponent = Cradle.Component.new(Example, "streamed", {})
return ExampleComponent
Start
Component:
Start
(
) →
nil
Starts the component, this will initialise the component and bind to the tag.
Usage
local Example = {}
Example.__index = Example
Example.Name = "Example Component"
function Example.new(instance)end
function Example:Init()end
function Example:Destroy() end
local ExampleComponent = Cradle.Component.new(Example, "streamed", {})
ExampleComponent:Start()
Stop
Component:
Stop
(
) →
nil
Stops the component, this will deinitialise the component and unbind from the tag.
Usage
local ExampleComponent = Cradle.Component.new(Example, "streamed", {})
ExampleComponent:Start()
ExampleComponent:Stop()
GetObjectFromInstance
Returns the component object from the instance.
Usage
local ExampleComponent = Cradle.Component.new(Example, "streamed", {})
ExampleComponent:Start()
local ExampleObject = ExampleComponent:GetObjectFromInstance(workspace.Example)