Part - iimurpyh/pilot-lua GitHub Wiki

The base type for all objects.

Table of contents

Properties

Methods

Events


Properties

string Part.ClassName

A string representing the type of the object. Ex: Port, Screen.


string Part.GUID

A Globally Unique Identifier that represents this part. Mostly for internal use. However, a part's GUID can be used with GetPartFromPort to make a reference to its attached parts.


Vector3 Part.Position

The part's Position.


CFrame Part.CFrame

The part's CFrame.


Methods

Color3 Part:GetColor() [IN UNSTABLE]

Gets the color of the part as a Color3.


Vector3 Part:GetSize() [IN UNSTABLE]

Gets the size of the part as a Vector3.


void Part:Trigger()

Activates the internal :Triggered event of the part. Not all parts tie their trigger signal functionality to this event, so this method should be avoided when possible. TriggerPort can be used to produce actual trigger signals, and you can sometimes avoid signals altogether with other methods like by configuring the SwitchValue of a toggleable part.


void Part:Configure(Dictionary properties)

Updates the part's configuration options.


EventConnection Part:Connect(string Event, function callback)

Connects to an event on a part. Some parts have special events.


Events

Event "Triggered"

An event which fires when the part is triggered.


Event "Configured"

An event which fires when the part is configured.


Code examples

local switch = GetPartFromPort(1, "Switch") --> Get the switch that is connected to the port with ID 1.
switch:Configure({ SwitchValue = true }) --> Enable the switch.
local port1 = GetPort(1) --> Get the Port part with ID 1
local port2 = GetPort(2)

--> When port 1 gets triggered, it triggers port 2.
port1:Connect("Triggered", function()
  port2:Trigger()
end)
⚠️ **GitHub.com Fallback** ⚠️