Instances / Base class
BasePart
Shared properties, pivot methods and contact events of Part and SpawnLocation.
Properties
| Name | Type | Description |
|---|---|---|
Position | Vector3 | Read/write world-space position. |
Orientation | Vector3 | Read/write XYZ rotation in degrees. This is the script-facing form of Studio's Orientation row under CFrame. |
Size | Vector3 | Read/write dimensions. Every component must be greater than zero. |
CFrame | CFrame | Read/write world-space position and rotation together. |
Shape | Enum.PartShape | Block, Ball, Cylinder, Wedge or CornerWedge. |
Bevel | number | Read/write edge rounding from 0 to 1. |
ShadeSmooth | boolean | Read/write smooth shading on generated curved geometry. |
Detail | integer | Read/write generated mesh detail from 1 through 16. MeshDetail is a compatibility alias. |
Vertices | integer | Read-only generated vertex count shown by Studio's Properties panel. |
Triangles | integer | Read-only generated triangle count shown by Studio's Properties panel. |
Color / Colour / Color3 / Colour3 | Color3 / Colour3 | Equivalent read/write aliases for the part colour. |
Transparency | number | Read/write transparency from 0 to 1. |
Anchored | boolean | When true, physics does not move the part. |
CanCollide | boolean | Controls whether the part participates in collisions. |
Methods
| Name | Type | Description |
|---|---|---|
GetPivot() | CFrame | Returns the BasePart's current CFrame. |
PivotTo(cframe) | method | Sets the BasePart's world-space position and rotation to the target CFrame. |
FindFirstChild(name, recursive?) | method | Finds a child or descendant by name. |
FindFirstChildOfClass(className) | method | Finds the first direct child with the exact class name. |
GetChildren() | table | Returns direct children. |
GetDescendants() | table | Returns all descendants. |
IsA(className) | boolean | Checks Part/SpawnLocation, BasePart, or Instance as supported. |
GetFullName() | string | Returns the dotted hierarchy name. |
Destroy() | method | Removes the instance and its children. |
Events
| Name | Type | Description |
|---|---|---|
Touched | signal | Fires when a new Workspace contact begins and passes the other BasePart. ServerScripts use the authoritative world; LocalScripts use that client's replicated/local world. |
Luau
script.Parent.Touched:Connect(function(hit)
print(hit:GetFullName())
end)Example: Make A Rounded Cylinder
Luau
local part = workspace:FindFirstChild("Part")
if part and part:IsA("BasePart") then
part.Shape = Enum.PartShape.Cylinder
part.Bevel = 0.4
part.ShadeSmooth = true
part.Detail = 8
print(part.Vertices, part.Triangles)
endIsA("BasePart") returns true for both Part and SpawnLocation.