Want a special badge and 30 bux? Make some PolyWorld! Content and post it in the Creations forum!
Dark mode is incomplete! Please report any issues to the Discord.

Part

LocalScripts Scripts

Parts are physical Instances in a place. Boxes, spheres, cylinders, and wedges are all Parts.

Inherits Instance.


Overview

Properties

Methods

Also inherits Instance methods.

Events


API

Properties

Color

Color : Color
The color of the Part.
Channel values are stored as 0 to 1. Use `Color.new` or `RGBColor.new` with 0 to 255 inputs when creating colors.

color

color deprecated : Color
Identical to Color.
No longer recommended for use.

Position

Position : Vector3
World position of the Part's center.

position

position deprecated : Vector3
Identical to Position.
No longer recommended for use.

Rotation

Rotation : Vector3
Euler rotation of the Part in degrees.

rotation

rotation deprecated : Vector3
Identical to Rotation.
No longer recommended for use.

Size

Size : Vector3
Size of the Part along each axis.

size

size deprecated : Vector3
Identical to Size.
No longer recommended for use.

Anchored

Anchored : bool
When true, the Part is not moved by physics.

anchored

anchored deprecated : bool
Identical to Anchored.
No longer recommended for use.

CanCollide

CanCollide : bool
When false, players and parts pass through this Part.

cancollide

cancollide deprecated : bool
Identical to CanCollide.
No longer recommended for use.

canCollide

canCollide deprecated : bool
Identical to CanCollide.
No longer recommended for use.

Transparency

Transparency : number
How see-through the Part is, from 0 (opaque) to 1 (invisible).

transparency

transparency deprecated : number
Identical to Transparency.
No longer recommended for use.

Velocity

Velocity : Vector3
Linear velocity of the Part.

velocity

velocity deprecated : Vector3
Identical to Velocity.
No longer recommended for use.

LinearVelocity

LinearVelocity deprecated : Vector3
Identical to Velocity.
No longer recommended for use.

linearVelocity

linearVelocity deprecated : Vector3
Identical to Velocity.
No longer recommended for use.

AngularVelocity

AngularVelocity : Vector3
Angular velocity of the Part.

angularVelocity

angularVelocity deprecated : Vector3
Identical to AngularVelocity.
No longer recommended for use.

Shape

Shape : PartShape
The collision and render shape of the Part.
One of Box, Sphere, Cylinder, or Wedge.
Parts with a MeshId report "Mesh".

MeshId

MeshId : int
Catalog mesh id drawn on this Part.
0 means no mesh (the Shape box / sphere / cylinder / wedge is used).
Setting this broadcasts the mesh to all clients.

part.MeshId = 12345

meshId

meshId deprecated : int
Identical to MeshId.
No longer recommended for use.

mesh_id

mesh_id deprecated : int
Identical to MeshId.
No longer recommended for use.

Collider

Collider : string
Collision hull used when MeshId is set.
One of "cube", "sphere", "low", "medium", or "high" (Low / Medium / High Precision).
Cube and Sphere are cheap primitives. The precision names sample the mesh at increasing triangle budgets.
Has no effect on non-mesh Shapes.

part.Collider = "medium"

collider

collider deprecated : string
Identical to Collider.
No longer recommended for use.

Material

Material : PartMaterial
Surface look of the Part.
One of Plastic, Grass, Dirt, Rock, Sand, Wood, Metal, Concrete, Planks, Bricks, LeafyGrass, Plywood, or Tiles.
Part color tints the texture. Plastic is the default smooth look.

part.Material = PartMaterial.Grass

Glow

Glow : number
Extra emissive brightness on the Part.
0 is none.

Client

Client readonly : bool
True if this Part was created on the client with `Instance.new("Part")`.
Client Parts are not replicated. Other players do not see them.
Server Parts always report false.

local p = Instance.new("Part")
print(p.Client) -- true in a LocalScript

ClickDetector

ClickDetector : table
A dummy table whose MouseClick and Clicked fields are the same Clicked event.
Exists so older part.ClickDetector.MouseClick:Connect(...) scripts keep working.
This is not a real child Instance.

TopSurface

TopSurface : SurfaceType
Studs / inlets on the +Y face.
One of Smooth, Stud, or Inlet. Same for the other five faces.

part.TopSurface = SurfaceType.Stud
part.BottomSurface = SurfaceType.Inlet

BottomSurface

BottomSurface : SurfaceType
−Y face.

FrontSurface

FrontSurface : SurfaceType
−Z face.

BackSurface

BackSurface : SurfaceType
+Z face.

LeftSurface

LeftSurface : SurfaceType
−X face.

RightSurface

RightSurface : SurfaceType
+X face.

Methods

BreakConnectors

BreakConnectors() : void
Breaks every Connector attached to this Part.
Each break fires ConnectorBroke on both connected Parts.

part:BreakConnectors()
Events

Clicked

Clicked : Event (player: Player)
Triggers when a player clicks this Part with no tool equipped.
Clicks beyond about 32 studs are ignored.

part.Clicked:Connect(function(player)
    player:Notify("You clicked " .. part.Name)
end)

part.MouseClick and part.ClickDetector.MouseClick are aliases of this event.

Defining function Clicked(player) in a Script parented to the Part is still supported.
Prefer Connect instead.

Touched

Touched : Event (player: Player)
Triggers once when a player enters this Part.

part.Touched:Connect(function(player)
    player.Character:Kill()
end)

Defining function Touched(player) in a Script parented to the Part is still supported.
Prefer Connect instead.
No longer recommended for use.

TouchEnded

TouchEnded : Event (player: Player)
Triggers when a player leaves this Part after a Touched enter.

PartTouched

PartTouched : Event (otherPart: Part)
Triggers when another Part starts overlapping or colliding with this Part.
This is Part-to-Part only. Player touches still use Touched.

part.PartTouched:Connect(function(otherPart)
    print(otherPart.Name, "hit me")
end)

PartStoppedTouching

PartStoppedTouching : Event (otherPart: Part)
Triggers when another Part stops overlapping or colliding with this Part after a PartTouched.

ConnectorBroke

ConnectorBroke : Event (connector: Connector, otherPart: Part?)
Triggers when a Connector on this Part breaks.
That includes calls to BreakConnectors, destroying the Connector, or the other Part being removed.
otherPart is the Part that was on the other side of the joint, if it still exists.

part.ConnectorBroke:Connect(function(connector, otherPart)
    print("Broke link to", otherPart and otherPart.Name)
end)