Skip to main content

PilotObject

The base object that all other objects inherit from.

Methods


CanInstallComponent(componentName) → canInstall

Checks if the specified component can be installed on the object.

The componentName parameter is the name of the component to check whether it is installable or not. It is a ComponentName. It can also be nil.

The canInstall return is whether or not the component can be installed on the object. It is a boolean.


CanUninstallComponent(componentName) → canUninstall

Checks if the specified component can be uninstalled from the object.

The componentName parameter is the name of the component to check whether it is uninstallable or not. It is a ComponentName. It can also be nil.

The canUninstall return is whether or not the component can be uninstalled from the object. It is a boolean.


Click()

Emulates a user clicking on the object, seems dysfunctional in some cases, (i.e., ClickButton components do not get triggered).


GetComponent(componentName) → component

Gets the component of the specified type for the object.

The componentName parameter is the name of the component to get. It is a ComponentName.

The component return is the component of the requested type for the object, or nil if it does not have the component. It is a Component. It can also be nil.


GetConfigurables() → configurables

Gets information about the configurables of the object.

The configurables return is an dictionary of configurable names to data about that configurable. It is a dictionary with keys that are strings and values that are ConfigurableDatas.


GetEvents() → events

Gets information about the events of the object.

The events return is an array of event names. It is an array of a strings.


GetMethods() → methods

Gets information about the methods of the object.

The methods return is an dictionary of method names to data about that method. It is a dictionary with keys that are strings and values that are MethodDatas.


GetOwnerId() → ownerId

Returns who locked the part if the part is locked, otherwise returns who created the part.

The ownerId return is the UserId of the 'owner' of the part. It is a number. It can also be nil.


GetShape() → shape

Gets the shape of the part.

The shape return is the shape of the part, or nil if the part is a block. It is a string. It can also be nil.


HasComponent() → hasComponent

Returns a boolean as to whether or not the object has the specified component.

The hasComponent return is whether or not the object has the specified component. It is a boolean.


HasPermission(permission) → hasPermission

Returns a boolean as to whether or not the microcontroller has permission to do the specified action.

The permission parameter is the permission to check for. It is a Permission.

The hasPermission return is whether or not the microcontroller has the specified permission. It is a boolean.


IsDestroyed() → isDestroyed

Returns a boolean as to whether or not the object is destroyed.

The isDestroyed return is whether or not the object is destroyed. It is a boolean.


IsGrounded() → isGrounded

Tells you if the part is grounded, meaning it does it have physics. If it is attached to terrain or an anchor for example, it will be grounded.

The isGrounded return is whether or not the object is grounded. It is a boolean.


ListComponents() → components

Lists all the components installed on the object.

The components return is an array of the names of the components installed on the object. It is an array of a strings.


Trigger()

Triggers the object.


GetColor() → color

warning

This method is deprecated. Use PilotObject.Color instead.

Gets the color of the object.

The color return is the color of the object. It is a Color3.


GetDurability() → durability

warning

This method is deprecated. Use PilotObject.Durability instead.

Gets the maximum (not current) durability of the object.

The durability return is the maximum durability of the object. It is a number.


GetNameOfOwnerAsync() → ownerUsername

warning

This method is deprecated. Use require("players"):GetUsername instead.

Returns the username of the owner of the part, if the part is locked, otherwise returns the username of the creator of the part.

The ownerUsername return is the username of the 'owner' of the part. It is a string. It can also be nil.


GetSize() → size

warning

This method is deprecated. Use PilotObject.Size instead.

Gets the size of the object.

The size return is the size of the object. It is a Vector3.


GetTemperature() → temperature

warning

This method is deprecated. Use PilotObject.Temperature instead.

Gets the temperature of the object.

The temperature return is the temperature of the object. It is a number.

Properties


Anchored

Whether or not the object is anchored. It is a boolean.


AssemblyCenterOfMass

The center of mass of the object's assembly. It is a Vector3.


AssemblyLinearVelocity

The velocity of the object's assembly. It is a Vector3.


AssemblyMass

The total mass of the object's assembly. It is a number.


CFrame

The current CFrame of the object. It is a CFrame.


ClassName

A string representing the type of the object. It is a string.


Color

The current color of the object. It is a Color3.


CreatedBy

The UserId of the user who created the part. Will be nil if the part was created by a constructor. It is a number?.


Durability

The total durability of the object. It is a number.

-- It can alternatively be calculated like so:
local partdata = require("partdata")
local partInfo = assert(partdata.Parts[part.ClassName], "unknown part")

local baseVolume = partInfo.BaseSize[1] * partInfo.BaseSize[2] * partInfo.BaseSize[3]
local volume = part.Size.X * part.Size.Y * part.Size.Z

local durability = ( volume / baseVolume ) ^ ( 1 / 3 ) * partInfo.BaseDurability

GUID

A unique identifier for the object, useful for comparing different references to the same object. It is a string.


Health

The health of the object as a percentage (between 0 and 1) of the total durability. It is a number. It ranges between 0 and 1.


Heat

The current heat of the object, this is different from the temperature. It is a number.


Mass

The mass of the object. It is a number.


Material

The current material of the object as an Enum.Material. It is an Enum.Material.


Orientation

The current orientation of the object. It is a Vector3.


PartLocked

The UserId of the user who locked the part. Will be nil if the part is unlocked. It is a number?.


Position

The current position of the object. It is a Vector3.


Size

The current size of the object. It is a Vector3.


Temperature

The current temperature of the object, this is different from the heat. It is a number.

Events


Destroying

Fires when the object is destroyed.