Part

Inherits from: BasePartPVInstanceInstance

The simplest, most common concrete BasePart - a single solid block, ball, cylinder, or wedge with no mesh or geometry of its own. Almost everything useful about a Part (Position, Size, Color, Anchored, Touched, and so on) is inherited from BasePart; Part itself only adds one thing: which basic shape to render as.

Code Snippet

local ball = Instance.new("Part")
ball.Shape = Enum.PartType.Ball
ball.Size = Vector3.new(4, 4, 4)
ball.Position = Vector3.new(0, 10, 0)
ball.Material = Enum.Material.SmoothPlastic
ball.Color = Color3.fromRGB(255, 0, 0)
ball.Parent = workspace

Properties

NameTypeDescription
ShapeEnum.PartTypeThe basic geometric shape to render: Ball, Block, Cylinder, or Wedge. Other BasePart subclasses (MeshPart, WedgePart, ...) don't have this property because their shape is implied by their class instead.

Inherited from BasePart

NameTypeDescription
PositionVector3The part's location in world space - shorthand for reading/writing just the position component of CFrame.
CFrameCFrameThe part's full position AND rotation in world space.
SizeVector3The part's dimensions along the X, Y, and Z axes, in studs.
OrientationVector3The part's rotation as X/Y/Z Euler angles in degrees - usually easier to read/set by hand than CFrame directly.
AnchoredbooleanWhether physics ignores the part - an anchored part never falls or gets pushed, and doesn't need to be held up by anything else.
CanCollidebooleanWhether other parts physically collide with this one. Does not affect whether Touched fires - see CanTouch.
CanTouchbooleanWhether Touched/TouchEnded fire for this part at all, independent of CanCollide.
CanQuerybooleanWhether the part is detected by spatial queries like raycasts (workspace:Raycast) and GetPartsInPart.
MasslessbooleanWhether the part contributes to its assembly's total mass and center of mass.
MaterialEnum.MaterialThe surface material, which drives both its default appearance and its physical friction/elasticity.
ColorColor3The part's color.
BrickColorBrickColorThe part's color expressed as a legacy BrickColor palette entry instead of a Color3 - reading/writing either one updates the other.
TransparencynumberHow see-through the part is, from 0 (fully opaque) to 1 (fully invisible).
ReflectancenumberHow reflective the part's surface is, from 0 to 1.
LockedbooleanPrevents the part from being selected or edited in Studio - purely an editor safeguard, has no effect at runtime.
MassnumberRead-only. The part's mass in kilograms, computed from its Size, Material, and CustomPhysicalProperties (if set).
AssemblyLinearVelocityVector3The current linear velocity of the whole connected assembly this part belongs to, in studs/second.
AssemblyAngularVelocityVector3The current angular (spin) velocity of the whole connected assembly this part belongs to.
CollisionGroupstringThe named collision group this part belongs to, used with PhysicsService to control which groups of parts can collide with each other.
CastShadowbooleanWhether the part casts a shadow from light sources.

Inherited from Instance

NameTypeDescription
ClassNamestringRead-only string naming the class this Instance belongs to.
NamestringA non-unique identifier of the Instance, used for organization and for accessing it in code. Maximum of 100 characters.
ParentInstanceThe hierarchical parent of the Instance. Setting this to nil removes the Instance from the DataModel tree unless something else still references it.
ArchivablebooleanWhether the Instance is included when the experience is published or saved, or when Clone() is called.
UniqueIdUniqueIdA read-only identifier for the Instance, distinct from Name, which is not guaranteed to be unique.

Methods

Inherited from BasePart

NameParametersReturnsDescription
GetMass():numberVoidnumberReturns the part's mass - equivalent to reading the Mass property.
GetVelocityAtPoint(worldPoint: Vector3):Vector3worldPoint: Vector3Vector3Returns the velocity of the part's assembly at the given world-space point, accounting for spin as well as linear motion.
ApplyImpulse(impulse: Vector3):voidimpulse: Vector3voidApplies an instantaneous linear impulse to the part's assembly, in world space - a quick, one-time push rather than a continuous force.
ApplyImpulseAtPosition(impulse: Vector3,position: Vector3):voidimpulse: Vector3, position: Vector3voidLike ApplyImpulse, but applied at a specific world-space position rather than through the center of mass - can impart spin.
GetConnectedParts(recursive: boolean?):{BasePart}recursive: boolean?{BasePart}Returns every part rigidly connected to this one through joints/welds. If recursive is true, follows the whole connected network rather than just direct connections.
GetJoints():{Instance}Void{Instance}Returns every joint (Weld, Motor6D, etc.) directly attached to this part.

Inherited from PVInstance

NameParametersReturnsDescription
GetPivot():CFrameVoidCFrameReturns the object's current pivot - the BasePart's own CFrame, or a Model's designated pivot CFrame.
PivotTo(targetCFrame: CFrame):voidtargetCFrame: CFramevoidMoves the object so its pivot matches targetCFrame. On a Model, every part inside moves together, preserving their relative arrangement - this is the modern, correct way to reposition a Model (prefer it over setting PrimaryPart's CFrame).
GetBoundingBox():CFrame,Vector3VoidCFrame, Vector3Returns a CFrame and a Size describing the smallest axis-aligned box that contains every BasePart within the object.

Inherited from Instance

NameParametersReturnsDescription
FindFirstChild(name: string,recursive: boolean?):Instance?name: string, recursive: boolean?Instance?Returns the first child of the Instance with the given name, or nil if no such child exists. Searches descendants too if recursive is true.
FindFirstChildOfClass(className: string):Instance?className: stringInstance?Returns the first child of the Instance whose ClassName equals the given className, or nil if none exists.
FindFirstChildWhichIsA(className: string,recursive: boolean?):Instance?className: string, recursive: boolean?Instance?Returns the first child whose class matches or inherits from className (unlike FindFirstChildOfClass, which requires an exact match), or nil if none exists.
FindFirstAncestor(name: string):Instance?name: stringInstance?Returns the first ancestor of the Instance whose Name equals the given name, or nil if none exists.
FindFirstAncestorOfClass(className: string):Instance?className: stringInstance?Returns the first ancestor of the Instance whose ClassName equals the given className, or nil if none exists.
WaitForChild(childName: string,timeOut: number?):Instance?childName: string, timeOut: number?Instance?Yields the current thread until a child with the given name exists, then returns it. If timeOut is given and exceeded, returns nil instead of continuing to wait.
GetChildren():{Instance}Void{Instance}Returns an array containing all of the Instance's direct children.
GetDescendants():{Instance}Void{Instance}Returns an array containing all of the Instance's descendants.
IsDescendantOf(ancestor: Instance):booleanancestor: InstancebooleanReturns true if the Instance is a descendant of the given ancestor.
IsAncestorOf(descendant: Instance):booleandescendant: InstancebooleanReturns true if the Instance is an ancestor of the given descendant.
GetFullName():stringVoidstringReturns a string describing the Instance's ancestry, formed by concatenating Names with periods.
Clone():Instance?VoidInstance?Creates a copy of the Instance and all of its descendants, ignoring any that are not Archivable. Returns nil if the Instance itself is not Archivable.
Destroy():voidVoidvoidSets Parent to nil, locks the Parent property, disconnects all connections, and calls Destroy() on all children.
IsA(className: string):booleanclassName: stringbooleanReturns true if the Instance's class matches or inherits from the given class.
SetAttribute(attribute: string,value: Variant):voidattribute: string, value: VariantvoidSets the attribute with the given name to the given value.
GetAttribute(attribute: string):Variantattribute: stringVariantReturns the value assigned to the given attribute name, or nil if not set.
GetAttributes():{[string]: Variant}Void{[string]: Variant}Returns a dictionary of every attribute set on the Instance, keyed by attribute name.
GetAttributeChangedSignal(attribute: string):RBXScriptSignalattribute: stringRBXScriptSignalReturns an event that fires whenever the given attribute's value changes.
GetPropertyChangedSignal(property: string):RBXScriptSignalproperty: stringRBXScriptSignalReturns an event that fires whenever the given property changes, useful for properties (like Position on a BasePart) that don't have their own dedicated event.

Events

Inherited from BasePart

NameParametersDescription
Touched(otherPart: BasePart)otherPart: BasePartFires when another part starts physically touching this one (requires CanTouch to be true on both).
TouchEnded(otherPart: BasePart)otherPart: BasePartFires when a part that was touching this one stops touching it.

Inherited from Instance

NameParametersDescription
Changed(property: string)property: stringFires whenever any property of the Instance changes, passing the name of the property that changed.
ChildAdded(child: Instance)child: InstanceFires when a new child is directly parented to the Instance.
ChildRemoved(child: Instance)child: InstanceFires when a direct child is removed (its Parent set to something else or nil).
DescendantAdded(descendant: Instance)descendant: InstanceFires when any descendant (a child, or a child's child, and so on) is added anywhere below the Instance.
DescendantRemoving(descendant: Instance)descendant: InstanceFires right before any descendant is about to be removed from the hierarchy below the Instance.
AncestryChanged(child: Instance,parent: Instance)child: Instance, parent: InstanceFires when the Parent property of the Instance, or any of its ancestors, changes.
AttributeChanged(attribute: string)attribute: stringFires whenever any attribute on the Instance changes, passing the attribute's name.
Destroying()VoidFires immediately before the Instance is destroyed by Destroy(), while it (and its descendants) can still be read one last time.

Constructors

Inherited from Instance

NameDescription
new(className: string,parent: Instance?):InstanceCreates a new Instance of the given class name. Abstract classes and services cannot be created with this constructor. Setting parent in the constructor is discouraged for performance reasons - prefer setting the Parent property last, after all other properties are set.