Learn
Engine Class
BasePart
Not Creatable
Not Browsable

Summary
Properties
BackParamA:number
Deprecated
BackParamB:number
Deprecated
BottomParamA:number
Deprecated
BottomParamB:number
Deprecated
Elasticity:number
Deprecated
Friction:number
Deprecated
FrontParamA:number
Deprecated
FrontParamB:number
Deprecated
LeftParamA:number
Deprecated
LeftParamB:number
Deprecated
RightParamA:number
Deprecated
RightParamB:number
Deprecated
RotVelocity:Vector3
Deprecated
TopParamA:number
Deprecated
TopParamB:number
Deprecated
Velocity:Vector3
Deprecated
Methods
AngularAccelerationToTorque(angAcceleration: Vector3,angVelocity: Vector3):Vector3
ApplyImpulse(impulse: Vector3):()
ApplyImpulseAtPosition(impulse: Vector3,position: Vector3):()
BreakJoints():()
Deprecated
breakJoints():()
Deprecated
GetJoints():Instances
getMass():number
Deprecated
GetRenderCFrame():CFrame
Deprecated
GetRootPart():Instance
Deprecated
GetTouchingParts():Instances
IntersectAsync(parts: Instances,collisionfidelity: Enum.CollisionFidelity,renderFidelity: Enum.RenderFidelity):Instance
MakeJoints():()
Deprecated
makeJoints():()
Deprecated
Resize(normalId: Enum.NormalId,deltaAmount: number):boolean
resize(normalId: Enum.NormalId,deltaAmount: number):boolean
Deprecated
SetNetworkOwner(playerInstance: Player):()
SubtractAsync(parts: Instances,collisionfidelity: Enum.CollisionFidelity,renderFidelity: Enum.RenderFidelity):Instance
UnionAsync(parts: Instances,collisionfidelity: Enum.CollisionFidelity,renderFidelity: Enum.RenderFidelity):Instance
Inherited Members

API Reference
Properties
Anchored
Read Parallel
Simulation Access
BasePart.Anchored:boolean
Code Samples
Part Anchored Toggle
local part = script.Parent
-- Create a ClickDetector so we can tell when the part is clicked
local cd = Instance.new("ClickDetector", part)
-- This function updates how the part looks based on its Anchored state
local function updateVisuals()
if part.Anchored then
-- When the part is anchored...
part.BrickColor = BrickColor.new("Bright red")
part.Material = Enum.Material.DiamondPlate
else
-- When the part is unanchored...
part.BrickColor = BrickColor.new("Bright yellow")
part.Material = Enum.Material.Wood
end
end
local function onToggle()
-- Toggle the anchored property
part.Anchored = not part.Anchored
-- Update visual state of the brick
updateVisuals()
end
-- Update, then start listening for clicks
updateVisuals()
cd.MouseClick:Connect(onToggle)

AssemblyAngularVelocity
Not Replicated
Read Parallel
Simulation Access
BasePart.AssemblyAngularVelocity:Vector3

AssemblyCenterOfMass
Read Only
Not Replicated
Read Parallel
Simulation Access
BasePart.AssemblyCenterOfMass:Vector3

AssemblyLinearVelocity
Not Replicated
Read Parallel
Simulation Access
BasePart.AssemblyLinearVelocity:Vector3

AssemblyMass
Read Only
Not Replicated
Read Parallel
Simulation Access
BasePart.AssemblyMass:number

AssemblyRootPart
Read Only
Not Replicated
Read Parallel
Simulation Access
BasePart.AssemblyRootPart:BasePart

AudioCanCollide
Read Parallel
Simulation Access
BasePart.AudioCanCollide:boolean

BackParamA
Deprecated

BackParamB
Deprecated

BackSurface
Read Parallel
BasePart.BackSurface:Enum.SurfaceType

BackSurfaceInput
Deprecated

BottomParamA
Deprecated

BottomParamB
Deprecated

BottomSurface
Read Parallel
BasePart.BottomSurface:Enum.SurfaceType

BottomSurfaceInput
Deprecated

BrickColor
Not Replicated
Read Parallel
BasePart.BrickColor:BrickColor

brickColor
Deprecated

CanCollide
Read Parallel
Simulation Access
BasePart.CanCollide:boolean
Code Samples
Fade Door
-- Paste into a Script inside a tall part
local part = script.Parent
local OPEN_TIME = 1
-- Can the door be opened at the moment?
local debounce = false
local function open()
part.CanCollide = false
part.Transparency = 0.7
part.BrickColor = BrickColor.new("Black")
end
local function close()
part.CanCollide = true
part.Transparency = 0
part.BrickColor = BrickColor.new("Bright blue")
end
local function onTouch(otherPart)
-- If the door was already open, do nothing
if debounce then
print("D")
return
end
-- Check if touched by a Humanoid
local human = otherPart.Parent:FindFirstChildOfClass("Humanoid")
if not human then
print("not human")
return
end
-- Perform the door opening sequence
debounce = true
open()
task.wait(OPEN_TIME)
close()
debounce = false
end
part.Touched:Connect(onTouch)
close()

CanQuery
Read Parallel
Simulation Access
BasePart.CanQuery:boolean

CanTouch
Read Parallel
Simulation Access
BasePart.CanTouch:boolean

CastShadow
Read Parallel
BasePart.CastShadow:boolean

CenterOfMass
Read Only
Not Replicated
Read Parallel
Simulation Access
BasePart.CenterOfMass:Vector3

CFrame
Read Parallel
Simulation Access
BasePart.CFrame:CFrame
Code Samples
Setting Part CFrame
local part = script.Parent:WaitForChild("Part")
local otherPart = script.Parent:WaitForChild("OtherPart")
-- Reset the part's CFrame to (0, 0, 0) with no rotation.
-- This is sometimes called the "identity" CFrame
part.CFrame = CFrame.new()
-- Set to a specific position (X, Y, Z)
part.CFrame = CFrame.new(0, 25, 10)
-- Same as above, but use a Vector3 instead
local point = Vector3.new(0, 25, 10)
part.CFrame = CFrame.new(point)
-- Set the part's CFrame to be at one point, looking at another
local lookAtPoint = Vector3.new(0, 20, 15)
part.CFrame = CFrame.lookAt(point, lookAtPoint)
-- Rotate the part's CFrame by pi/2 radians on local X axis
part.CFrame = part.CFrame * CFrame.Angles(math.pi / 2, 0, 0)
-- Rotate the part's CFrame by 45 degrees on local Y axis
part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(45), 0)
-- Rotate the part's CFrame by 180 degrees on global Z axis (note the order!)
part.CFrame = CFrame.Angles(0, 0, math.pi) * part.CFrame -- Pi radians is equal to 180 degrees
-- Composing two CFrames is done using * (the multiplication operator)
part.CFrame = CFrame.new(2, 3, 4) * CFrame.new(4, 5, 6) --> equal to CFrame.new(6, 8, 10)
-- Unlike algebraic multiplication, CFrame composition is NOT communitative: a * b is not necessarily b * a!
-- Imagine * as an ORDERED series of actions. For example, the following lines produce different CFrames:
-- 1) Slide the part 5 units on X.
-- 2) Rotate the part 45 degrees around its Y axis.
part.CFrame = CFrame.new(5, 0, 0) * CFrame.Angles(0, math.rad(45), 0)
-- 1) Rotate the part 45 degrees around its Y axis.
-- 2) Slide the part 5 units on X.
part.CFrame = CFrame.Angles(0, math.rad(45), 0) * CFrame.new(5, 0, 0)
-- There is no "CFrame division", but instead simply "doing the inverse operation".
part.CFrame = CFrame.new(4, 5, 6) * CFrame.new(4, 5, 6):Inverse() --> is equal to CFrame.new(0, 0, 0)
part.CFrame = CFrame.Angles(0, 0, math.pi) * CFrame.Angles(0, 0, math.pi):Inverse() --> equal to CFrame.Angles(0, 0, 0)
-- Position a part relative to another (in this case, put our part on top of otherPart)
part.CFrame = otherPart.CFrame * CFrame.new(0, part.Size.Y / 2 + otherPart.Size.Y / 2, 0)

CollisionGroup
Not Replicated
Read Parallel
Simulation Access
BasePart.CollisionGroup:string
Code Samples
PhysicsService:RegisterCollisionGroup
local PhysicsService = game:GetService("PhysicsService")
local collisionGroupBall = "CollisionGroupBall"
local collisionGroupDoor = "CollisionGroupDoor"
-- Register collision groups
PhysicsService:RegisterCollisionGroup(collisionGroupBall)
PhysicsService:RegisterCollisionGroup(collisionGroupDoor)
-- Assign parts to collision groups
script.Parent.BallPart.CollisionGroup = collisionGroupBall
script.Parent.DoorPart.CollisionGroup = collisionGroupDoor
-- Set groups as non-collidable with each other and check the result
PhysicsService:CollisionGroupSetCollidable(collisionGroupBall, collisionGroupDoor, false)
print(PhysicsService:CollisionGroupsAreCollidable(collisionGroupBall, collisionGroupDoor)) --> false

CollisionGroupId
Deprecated

Color
Not Replicated
Read Parallel
BasePart.Color:Color3
Code Samples
Character Health Body Color
-- Paste into a Script within StarterCharacterScripts
-- Then play the game, and fiddle with your character's health
local char = script.Parent
local human = char.Humanoid
local colorHealthy = Color3.new(0.4, 1, 0.2)
local colorUnhealthy = Color3.new(1, 0.4, 0.2)
local function setColor(color)
for _, child in pairs(char:GetChildren()) do
if child:IsA("BasePart") then
child.Color = color
while child:FindFirstChildOfClass("Decal") do
child:FindFirstChildOfClass("Decal"):Destroy()
end
elseif child:IsA("Accessory") then
child.Handle.Color = color
local mesh = child.Handle:FindFirstChildOfClass("SpecialMesh")
if mesh then
mesh.TextureId = ""
end
elseif child:IsA("Shirt") or child:IsA("Pants") then
child:Destroy()
end
end
end
local function update()
local percentage = human.Health / human.MaxHealth
-- Create a color by tweening based on the percentage of your health
-- The color goes from colorHealthy (100%) ----- > colorUnhealthy (0%)
local color = Color3.new(
colorHealthy.R * percentage + colorUnhealthy.r * (1 - percentage),
colorHealthy.G * percentage + colorUnhealthy.g * (1 - percentage),
colorHealthy.B * percentage + colorUnhealthy.b * (1 - percentage)
)
setColor(color)
end
update()
human.HealthChanged:Connect(update)

CurrentPhysicalProperties
Read Only
Not Replicated
Read Parallel
BasePart.CurrentPhysicalProperties:PhysicalProperties

CustomPhysicalProperties
Read Parallel
Simulation Access
BasePart.CustomPhysicalProperties:PhysicalProperties
Code Samples
Set CustomPhysicalProperties
local part = script.Parent
-- This will make the part light and bouncy!
local DENSITY = 0.3
local FRICTION = 0.1
local ELASTICITY = 1
local FRICTION_WEIGHT = 1
local ELASTICITY_WEIGHT = 1
local physProperties = PhysicalProperties.new(DENSITY, FRICTION, ELASTICITY, FRICTION_WEIGHT, ELASTICITY_WEIGHT)
part.CustomPhysicalProperties = physProperties

Elasticity
Deprecated

EnableFluidForces
Read Parallel
Simulation Access
BasePart.EnableFluidForces:boolean

ExtentsCFrame
Read Only
Not Replicated
Read Parallel
Simulation Access
BasePart.ExtentsCFrame:CFrame

ExtentsSize
Read Only
Not Replicated
Read Parallel
Simulation Access
BasePart.ExtentsSize:Vector3

Friction
Deprecated

FrontParamA
Deprecated

FrontParamB
Deprecated

FrontSurface
Read Parallel
BasePart.FrontSurface:Enum.SurfaceType

FrontSurfaceInput
Deprecated

LeftParamA
Deprecated

LeftParamB
Deprecated

LeftSurface
Read Parallel
BasePart.LeftSurface:Enum.SurfaceType

LeftSurfaceInput
Deprecated

LocalTransparencyModifier
Hidden
Not Replicated
Read Parallel
BasePart.LocalTransparencyModifier:number

Locked
Read Parallel
Simulation Access
BasePart.Locked:boolean
Code Samples
Recursive Unlock
-- Paste into a Script within a Model you want to unlock
local model = script.Parent
-- This function recurses through a model's heirarchy and unlocks
-- every part that it encounters.
local function recursiveUnlock(object)
if object:IsA("BasePart") then
object.Locked = false
end
-- Call the same function on the children of the object
-- The recursive process stops if an object has no children
for _, child in pairs(object:GetChildren()) do
recursiveUnlock(child)
end
end
recursiveUnlock(model)

Mass
Read Only
Not Replicated
Read Parallel
Simulation Access
BasePart.Mass:number

Massless
Read Parallel
Simulation Access
BasePart.Massless:boolean

Material
Read Parallel
Simulation Access
BasePart.Material:Enum.Material

MaterialVariant
Not Replicated
Read Parallel
Simulation Access
BasePart.MaterialVariant:string

Orientation
Hidden
Not Replicated
Read Parallel
Simulation Access
BasePart.Orientation:Vector3
Code Samples
Part Spinner
local part = script.Parent
local INCREMENT = 360 / 20
-- Rotate the part continually
while true do
for degrees = 0, 360, INCREMENT do
-- Set only the Y axis rotation
part.Rotation = Vector3.new(0, degrees, 0)
-- A better way to do this would be setting CFrame
--part.CFrame = CFrame.new(part.Position) * CFrame.Angles(0, math.rad(degrees), 0)
task.wait()
end
end

PivotOffset
Read Parallel
Simulation Access
BasePart.PivotOffset:CFrame
Code Samples
Reset Pivot
local function resetPivot(model)
local boundsCFrame = model:GetBoundingBox()
if model.PrimaryPart then
model.PrimaryPart.PivotOffset = model.PrimaryPart.CFrame:ToObjectSpace(boundsCFrame)
else
model.WorldPivot = boundsCFrame
end
end
resetPivot(script.Parent)
Clock Hands
local function createHand(length, width, yOffset)
local part = Instance.new("Part")
part.Size = Vector3.new(width, 0.1, length)
part.Material = Enum.Material.Neon
part.PivotOffset = CFrame.new(0, -(yOffset + 0.1), length / 2)
part.Anchored = true
part.Parent = workspace
return part
end
local function positionHand(hand, fraction)
hand:PivotTo(CFrame.fromEulerAnglesXYZ(0, -fraction * 2 * math.pi, 0))
end
-- Create dial
for i = 0, 11 do
local dialPart = Instance.new("Part")
dialPart.Size = Vector3.new(0.2, 0.2, 1)
dialPart.TopSurface = Enum.SurfaceType.Smooth
if i == 0 then
dialPart.Size = Vector3.new(0.2, 0.2, 2)
dialPart.Color = Color3.new(1, 0, 0)
end
dialPart.PivotOffset = CFrame.new(0, -0.1, 10.5)
dialPart.Anchored = true
dialPart:PivotTo(CFrame.fromEulerAnglesXYZ(0, (i / 12) * 2 * math.pi, 0))
dialPart.Parent = workspace
end
-- Create hands
local hourHand = createHand(7, 1, 0)
local minuteHand = createHand(10, 0.6, 0.1)
local secondHand = createHand(11, 0.2, 0.2)
-- Run clock
while true do
local components = os.date("*t")
positionHand(hourHand, (components.hour + components.min / 60) / 12)
positionHand(minuteHand, (components.min + components.sec / 60) / 60)
positionHand(secondHand, components.sec / 60)
task.wait()
end

Position
Hidden
Not Replicated
Read Parallel
Simulation Access
BasePart.Position:Vector3

ReceiveAge
Hidden
Read Only
Not Replicated
Read Parallel
BasePart.ReceiveAge:number

Reflectance
Read Parallel
BasePart.Reflectance:number

ResizeableFaces
Read Only
Not Replicated
Read Parallel
BasePart.ResizeableFaces:Faces
Code Samples
Resize Handles
-- Put this Script in several kinds of BasePart, like
-- Part, TrussPart, WedgePart, CornerWedgePart, etc.
local part = script.Parent
-- Create a handles object for this part
local handles = Instance.new("Handles")
handles.Adornee = part
handles.Parent = part
-- Manually specify the faces applicable for this handle
handles.Faces = Faces.new(Enum.NormalId.Top, Enum.NormalId.Front, Enum.NormalId.Left)
-- Alternatively, use the faces on which the part can be resized.
-- If part is a TrussPart with only two Size dimensions
-- of length 2, then ResizeableFaces will only have two
-- enabled faces. For other parts, all faces will be enabled.
handles.Faces = part.ResizeableFaces

ResizeIncrement
Read Only
Not Replicated
Read Parallel
BasePart.ResizeIncrement:number

RightParamA
Deprecated

RightParamB
Deprecated

RightSurface
Read Parallel
BasePart.RightSurface:Enum.SurfaceType

RightSurfaceInput
Deprecated

RootPriority
Read Parallel
BasePart.RootPriority:number

Rotation
Not Replicated
Read Parallel
Simulation Access
BasePart.Rotation:Vector3

RotVelocity
Deprecated

Size
Not Replicated
Read Parallel
Simulation Access
BasePart.Size:Vector3
Code Samples
Pyramid Builder
local TOWER_BASE_SIZE = 30
local position = Vector3.new(50, 50, 50)
local hue = math.random()
local color0 = Color3.fromHSV(hue, 1, 1)
local color1 = Color3.fromHSV((hue + 0.35) % 1, 1, 1)
local model = Instance.new("Model")
model.Name = "Tower"
for i = TOWER_BASE_SIZE, 1, -2 do
local part = Instance.new("Part")
part.Size = Vector3.new(i, 2, i)
part.Position = position
part.Anchored = true
part.Parent = model
-- Tween from color0 and color1
local perc = i / TOWER_BASE_SIZE
part.Color = Color3.new(
color0.R * perc + color1.R * (1 - perc),
color0.G * perc + color1.G * (1 - perc),
color0.B * perc + color1.B * (1 - perc)
)
position = position + Vector3.new(0, part.Size.Y, 0)
end
model.Parent = workspace

SpecificGravity
Deprecated

TopParamA
Deprecated

TopParamB
Deprecated

TopSurface
Read Parallel
BasePart.TopSurface:Enum.SurfaceType

TopSurfaceInput
Deprecated

Transparency
Read Parallel
BasePart.Transparency:number
Code Samples
Fade Door
-- Paste into a Script inside a tall part
local part = script.Parent
local OPEN_TIME = 1
-- Can the door be opened at the moment?
local debounce = false
local function open()
part.CanCollide = false
part.Transparency = 0.7
part.BrickColor = BrickColor.new("Black")
end
local function close()
part.CanCollide = true
part.Transparency = 0
part.BrickColor = BrickColor.new("Bright blue")
end
local function onTouch(otherPart)
-- If the door was already open, do nothing
if debounce then
print("D")
return
end
-- Check if touched by a Humanoid
local human = otherPart.Parent:FindFirstChildOfClass("Humanoid")
if not human then
print("not human")
return
end
-- Perform the door opening sequence
debounce = true
open()
task.wait(OPEN_TIME)
close()
debounce = false
end
part.Touched:Connect(onTouch)
close()

Velocity
Deprecated

Methods
AngularAccelerationToTorque
Simulation Access
BasePart:AngularAccelerationToTorque(
angAcceleration:Vector3, angVelocity:Vector3
Parameters
angAcceleration:Vector3
angVelocity:Vector3
Default Value: "0, 0, 0"
Returns

ApplyAngularImpulse
Simulation Access
BasePart:ApplyAngularImpulse(impulse:Vector3):()
Parameters
impulse:Vector3
Returns
()

ApplyImpulse
Simulation Access
BasePart:ApplyImpulse(impulse:Vector3):()
Parameters
impulse:Vector3
Returns
()

ApplyImpulseAtPosition
Simulation Access
BasePart:ApplyImpulseAtPosition(
impulse:Vector3, position:Vector3
):()
Parameters
impulse:Vector3
position:Vector3
Returns
()

BreakJoints
Deprecated

breakJoints
Deprecated

CanCollideWith
Write Parallel
Simulation Access
BasePart:CanCollideWith(part:BasePart):boolean
Parameters
Returns

CanSetNetworkOwnership
Simulation Access
BasePart:CanSetNetworkOwnership():Tuple
Returns
Code Samples
Check if a Part's Network Ownership Can Be Set
local part = workspace:FindFirstChild("Part")
if part and part:IsA("BasePart") then
local canSet, errorReason = part:CanSetNetworkOwnership()
if canSet then
print(part:GetFullName() .. "'s Network Ownership can be changed!")
else
warn("Cannot change the Network Ownership of " .. part:GetFullName() .. " because: " .. errorReason)
end
end

GetClosestPointOnSurface
Simulation Access
BasePart:GetClosestPointOnSurface(position:Vector3):Vector3
Parameters
position:Vector3
Returns

GetConnectedParts
Write Parallel
BasePart:GetConnectedParts(recursive:boolean):{BasePart}
Parameters
recursive:boolean
Default Value: false
Returns

GetJoints
Write Parallel
Simulation Access
BasePart:GetJoints():Instances
Returns
Instances

GetMass
Write Parallel
Simulation Access
BasePart:GetMass():number
Returns
Code Samples
Finding a Part's Mass
local myPart = Instance.new("Part")
myPart.Size = Vector3.new(4, 6, 4)
myPart.Anchored = true
myPart.Parent = workspace
local myMass = myPart:GetMass()
print("My part's mass is " .. myMass)

getMass
Deprecated

GetNetworkOwner
Write Parallel
Simulation Access
BasePart:GetNetworkOwner():Instance
Returns

GetNetworkOwnershipAuto
Write Parallel
Simulation Access
BasePart:GetNetworkOwnershipAuto():boolean
Returns

GetNoCollisionConstraints
Simulation Access
BasePart:GetNoCollisionConstraints():Instances
Returns
Instances

GetRenderCFrame
Deprecated

GetRootPart
Deprecated

GetTouchingParts
Simulation Access
BasePart:GetTouchingParts():Instances
Returns
Instances

GetVelocityAtPosition
Write Parallel
Simulation Access
BasePart:GetVelocityAtPosition(position:Vector3):Vector3
Parameters
position:Vector3
Returns

IntersectAsync
Yields
Capabilities: CSG
BasePart:IntersectAsync(
parts:Instances, collisionfidelity:Enum.CollisionFidelity, renderFidelity:Enum.RenderFidelity
Parameters
parts:Instances
collisionfidelity:Enum.CollisionFidelity
Default Value: "Default"
renderFidelity:Enum.RenderFidelity
Default Value: "Automatic"
Returns

IsGrounded
Write Parallel
Simulation Access
BasePart:IsGrounded():boolean
Returns

MakeJoints
Deprecated

makeJoints
Deprecated

Resize
Simulation Access
BasePart:Resize(
normalId:Enum.NormalId, deltaAmount:number
Parameters
normalId:Enum.NormalId
deltaAmount:number
Returns

resize
Deprecated

SetNetworkOwner
Simulation Access
BasePart:SetNetworkOwner(playerInstance:Player):()
Parameters
playerInstance:Player
Default Value: "nil"
Returns
()

SetNetworkOwnershipAuto
Simulation Access
BasePart:SetNetworkOwnershipAuto():()
Returns
()

SubtractAsync
Yields
Capabilities: CSG
BasePart:SubtractAsync(
parts:Instances, collisionfidelity:Enum.CollisionFidelity, renderFidelity:Enum.RenderFidelity
Parameters
parts:Instances
collisionfidelity:Enum.CollisionFidelity
Default Value: "Default"
renderFidelity:Enum.RenderFidelity
Default Value: "Automatic"
Returns
Code Samples
BasePart:SubtractAsync()
local Workspace = game:GetService("Workspace")
local mainPart = script.Parent.PartA
local otherParts = { script.Parent.PartB, script.Parent.PartC }
-- Perform subtract operation
local success, newSubtract = pcall(function()
return mainPart:SubtractAsync(otherParts)
end)
-- If operation succeeds, position it at the same location and parent it to the workspace
if success and newSubtract then
newSubtract.Position = mainPart.Position
newSubtract.Parent = Workspace
end
-- Destroy original parts which remain intact after operation
mainPart:Destroy()
for _, part in otherParts do
part:Destroy()
end

TorqueToAngularAcceleration
Simulation Access
BasePart:TorqueToAngularAcceleration(
torque:Vector3, angVelocity:Vector3
Parameters
torque:Vector3
angVelocity:Vector3
Default Value: "0, 0, 0"
Returns

UnionAsync
Yields
Capabilities: CSG
BasePart:UnionAsync(
parts:Instances, collisionfidelity:Enum.CollisionFidelity, renderFidelity:Enum.RenderFidelity
Parameters
parts:Instances
collisionfidelity:Enum.CollisionFidelity
Default Value: "Default"
renderFidelity:Enum.RenderFidelity
Default Value: "Automatic"
Returns
Code Samples
BasePart:UnionAsync()
local Workspace = game:GetService("Workspace")
local mainPart = script.Parent.PartA
local otherParts = { script.Parent.PartB, script.Parent.PartC }
-- Perform union operation
local success, newUnion = pcall(function()
return mainPart:UnionAsync(otherParts)
end)
-- If operation succeeds, position it at the same location and parent it to the workspace
if success and newUnion then
newUnion.Position = mainPart.Position
newUnion.Parent = Workspace
end
-- Destroy original parts which remain intact after operation
mainPart:Destroy()
for _, part in otherParts do
part:Destroy()
end

Events
LocalSimulationTouched
Deprecated

OutfitChanged
Deprecated

StoppedTouching
Deprecated

Touched
BasePart.Touched(otherPart:BasePart):RBXScriptSignal
Parameters
otherPart:BasePart
Code Samples
Touching Parts Count
local part = script.Parent
local billboardGui = Instance.new("BillboardGui")
billboardGui.Size = UDim2.new(0, 200, 0, 50)
billboardGui.Adornee = part
billboardGui.AlwaysOnTop = true
billboardGui.Parent = part
local tl = Instance.new("TextLabel")
tl.Size = UDim2.new(1, 0, 1, 0)
tl.BackgroundTransparency = 1
tl.Parent = billboardGui
local numTouchingParts = 0
local function onTouch(otherPart)
print("Touch started: " .. otherPart.Name)
numTouchingParts = numTouchingParts + 1
tl.Text = numTouchingParts
end
local function onTouchEnded(otherPart)
print("Touch ended: " .. otherPart.Name)
numTouchingParts = numTouchingParts - 1
tl.Text = numTouchingParts
end
part.Touched:Connect(onTouch)
part.TouchEnded:Connect(onTouchEnded)
Model Touched
local model = script.Parent
local function onTouched(otherPart)
-- Ignore instances of the model coming in contact with itself
if otherPart:IsDescendantOf(model) then
return
end
print(model.Name .. " collided with " .. otherPart.Name)
end
for _, child in pairs(model:GetChildren()) do
if child:IsA("BasePart") then
child.Touched:Connect(onTouched)
end
end

TouchEnded
BasePart.TouchEnded(otherPart:BasePart):RBXScriptSignal
Parameters
otherPart:BasePart
Code Samples
Touching Parts Count
local part = script.Parent
local billboardGui = Instance.new("BillboardGui")
billboardGui.Size = UDim2.new(0, 200, 0, 50)
billboardGui.Adornee = part
billboardGui.AlwaysOnTop = true
billboardGui.Parent = part
local tl = Instance.new("TextLabel")
tl.Size = UDim2.new(1, 0, 1, 0)
tl.BackgroundTransparency = 1
tl.Parent = billboardGui
local numTouchingParts = 0
local function onTouch(otherPart)
print("Touch started: " .. otherPart.Name)
numTouchingParts = numTouchingParts + 1
tl.Text = numTouchingParts
end
local function onTouchEnded(otherPart)
print("Touch ended: " .. otherPart.Name)
numTouchingParts = numTouchingParts - 1
tl.Text = numTouchingParts
end
part.Touched:Connect(onTouch)
part.TouchEnded:Connect(onTouchEnded)

©2026 Roblox Corporation. Roblox, the Roblox logo and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.