BasePart
Inherits from: PVInstance → Instance
An abstract class - every physical, 3D object you can see and touch in the workspace (Part, MeshPart, WedgePart, UnionOperation, SpawnLocation, and more) inherits from BasePart. It's where all the shared physics, appearance, and collision behavior lives, so a script that only cares about "some solid object" - regardless of its exact shape - almost always types its parameter as BasePart rather than the more specific Part.
Code Snippet
local part = Instance.new("Part") -- BasePart itself is never created directly
part.Size = Vector3.new(4, 1, 4)
part.Position = Vector3.new(0, 10, 0)
part.Anchored = true
part.Material = Enum.Material.Neon
part.Color = Color3.fromRGB(255, 170, 0)
part.Parent = workspace
part.Touched:Connect(function(otherPart)
print(otherPart.Name .. " touched " .. part.Name)
end)
Properties
| Name | Type | Description |
|---|---|---|
| Position | Vector3 | The part's location in world space - shorthand for reading/writing just the position component of CFrame. |
| CFrame | CFrame | The part's full position AND rotation in world space. |
| Size | Vector3 | The part's dimensions along the X, Y, and Z axes, in studs. |
| Orientation | Vector3 | The part's rotation as X/Y/Z Euler angles in degrees - usually easier to read/set by hand than CFrame directly. |
| Anchored | boolean | Whether physics ignores the part - an anchored part never falls or gets pushed, and doesn't need to be held up by anything else. |
| CanCollide | boolean | Whether other parts physically collide with this one. Does not affect whether Touched fires - see CanTouch. |
| CanTouch | boolean | Whether Touched/TouchEnded fire for this part at all, independent of CanCollide. |
| CanQuery | boolean | Whether the part is detected by spatial queries like raycasts (workspace:Raycast) and GetPartsInPart. |
| Massless | boolean | Whether the part contributes to its assembly's total mass and center of mass. |
| Material | Enum.Material | The surface material, which drives both its default appearance and its physical friction/elasticity. |
| Color | Color3 | The part's color. |
| BrickColor | BrickColor | The part's color expressed as a legacy BrickColor palette entry instead of a Color3 - reading/writing either one updates the other. |
| Transparency | number | How see-through the part is, from 0 (fully opaque) to 1 (fully invisible). |
| Reflectance | number | How reflective the part's surface is, from 0 to 1. |
| Locked | boolean | Prevents the part from being selected or edited in Studio - purely an editor safeguard, has no effect at runtime. |
| Mass | number | Read-only. The part's mass in kilograms, computed from its Size, Material, and CustomPhysicalProperties (if set). |
| AssemblyLinearVelocity | Vector3 | The current linear velocity of the whole connected assembly this part belongs to, in studs/second. |
| AssemblyAngularVelocity | Vector3 | The current angular (spin) velocity of the whole connected assembly this part belongs to. |
| CollisionGroup | string | The named collision group this part belongs to, used with PhysicsService to control which groups of parts can collide with each other. |
| CastShadow | boolean | Whether the part casts a shadow from light sources. |
Inherited from Instance
| Name | Type | Description |
|---|---|---|
| ClassName | string | Read-only string naming the class this Instance belongs to. |
| Name | string | A non-unique identifier of the Instance, used for organization and for accessing it in code. Maximum of 100 characters. |
| Parent | Instance | The hierarchical parent of the Instance. Setting this to nil removes the Instance from the DataModel tree unless something else still references it. |
| Archivable | boolean | Whether the Instance is included when the experience is published or saved, or when Clone() is called. |
| UniqueId | UniqueId | A read-only identifier for the Instance, distinct from Name, which is not guaranteed to be unique. |
Methods
| Name | Parameters | Returns | Description |
|---|---|---|---|
| GetMass():number | Void | number | Returns the part's mass - equivalent to reading the Mass property. |
| GetVelocityAtPoint(worldPoint: Vector3):Vector3 | worldPoint: Vector3 | Vector3 | Returns the velocity of the part's assembly at the given world-space point, accounting for spin as well as linear motion. |
| ApplyImpulse(impulse: Vector3):void | impulse: Vector3 | void | Applies 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):void | impulse: Vector3, position: Vector3 | void | Like 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
| Name | Parameters | Returns | Description |
|---|---|---|---|
| GetPivot():CFrame | Void | CFrame | Returns the object's current pivot - the BasePart's own CFrame, or a Model's designated pivot CFrame. |
| PivotTo(targetCFrame: CFrame):void | targetCFrame: CFrame | void | Moves 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,Vector3 | Void | CFrame, Vector3 | Returns a CFrame and a Size describing the smallest axis-aligned box that contains every BasePart within the object. |
Inherited from Instance
| Name | Parameters | Returns | Description |
|---|---|---|---|
| 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: string | Instance? | 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: string | Instance? | Returns the first ancestor of the Instance whose Name equals the given name, or nil if none exists. |
| FindFirstAncestorOfClass(className: string):Instance? | className: string | Instance? | 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):boolean | ancestor: Instance | boolean | Returns true if the Instance is a descendant of the given ancestor. |
| IsAncestorOf(descendant: Instance):boolean | descendant: Instance | boolean | Returns true if the Instance is an ancestor of the given descendant. |
| GetFullName():string | Void | string | Returns a string describing the Instance's ancestry, formed by concatenating Names with periods. |
| Clone():Instance? | Void | Instance? | 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():void | Void | void | Sets Parent to nil, locks the Parent property, disconnects all connections, and calls Destroy() on all children. |
| IsA(className: string):boolean | className: string | boolean | Returns true if the Instance's class matches or inherits from the given class. |
| SetAttribute(attribute: string,value: Variant):void | attribute: string, value: Variant | void | Sets the attribute with the given name to the given value. |
| GetAttribute(attribute: string):Variant | attribute: string | Variant | Returns 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):RBXScriptSignal | attribute: string | RBXScriptSignal | Returns an event that fires whenever the given attribute's value changes. |
| GetPropertyChangedSignal(property: string):RBXScriptSignal | property: string | RBXScriptSignal | Returns 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
| Name | Parameters | Description |
|---|---|---|
| Touched(otherPart: BasePart) | otherPart: BasePart | Fires when another part starts physically touching this one (requires CanTouch to be true on both). |
| TouchEnded(otherPart: BasePart) | otherPart: BasePart | Fires when a part that was touching this one stops touching it. |
Inherited from Instance
| Name | Parameters | Description |
|---|---|---|
| Changed(property: string) | property: string | Fires whenever any property of the Instance changes, passing the name of the property that changed. |
| ChildAdded(child: Instance) | child: Instance | Fires when a new child is directly parented to the Instance. |
| ChildRemoved(child: Instance) | child: Instance | Fires when a direct child is removed (its Parent set to something else or nil). |
| DescendantAdded(descendant: Instance) | descendant: Instance | Fires when any descendant (a child, or a child's child, and so on) is added anywhere below the Instance. |
| DescendantRemoving(descendant: Instance) | descendant: Instance | Fires right before any descendant is about to be removed from the hierarchy below the Instance. |
| AncestryChanged(child: Instance,parent: Instance) | child: Instance, parent: Instance | Fires when the Parent property of the Instance, or any of its ancestors, changes. |
| AttributeChanged(attribute: string) | attribute: string | Fires whenever any attribute on the Instance changes, passing the attribute's name. |
| Destroying() | Void | Fires immediately before the Instance is destroyed by Destroy(), while it (and its descendants) can still be read one last time. |
Related
- PVInstance - where GetPivot()/PivotTo() actually come from.
- Model - groups multiple BaseParts together.
Constructors
Inherited from Instance
| Name | Description |
|---|---|
| new(className: string,parent: Instance?):Instance | Creates 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. |