Ghi chú phát hành
Học
Lớp công cụ
BasePart
Không Thể Tạo
Không Thể Duyệt

*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.


Tóm Tắt
Thuộc Tính
BackParamA:number
Đã Lỗi Thời
BackParamB:number
Đã Lỗi Thời
BottomParamA:number
Đã Lỗi Thời
BottomParamB:number
Đã Lỗi Thời
brickColor:BrickColor
Đã Lỗi Thời
CollisionGroupId:number
Đã Lỗi Thời
Elasticity:number
Đã Lỗi Thời
Friction:number
Đã Lỗi Thời
FrontParamA:number
Đã Lỗi Thời
FrontParamB:number
Đã Lỗi Thời
LeftParamA:number
Đã Lỗi Thời
LeftParamB:number
Đã Lỗi Thời
RightParamA:number
Đã Lỗi Thời
RightParamB:number
Đã Lỗi Thời
RotVelocity:Vector3
Đã Lỗi Thời
SpecificGravity:number
Đã Lỗi Thời
TopParamA:number
Đã Lỗi Thời
TopParamB:number
Đã Lỗi Thời
Velocity:Vector3
Đã Lỗi Thời
Phương Pháp
AngularAccelerationToTorque(angAcceleration: Vector3,angVelocity: Vector3):Vector3
ApplyImpulse(impulse: Vector3):()
ApplyImpulseAtPosition(impulse: Vector3,position: Vector3):()
BreakJoints():()
Đã Lỗi Thời
breakJoints():()
Đã Lỗi Thời
GetJoints():Instances
getMass():number
Đã Lỗi Thời
GetRenderCFrame():CFrame
Đã Lỗi Thời
GetRootPart():Instance
Đã Lỗi Thời
GetTouchingParts():Instances
IntersectAsync(parts: Instances,collisionfidelity: Enum.CollisionFidelity,renderFidelity: Enum.RenderFidelity):Instance
MakeJoints():()
Đã Lỗi Thời
makeJoints():()
Đã Lỗi Thời
Resize(normalId: Enum.NormalId,deltaAmount: number):boolean
resize(normalId: Enum.NormalId,deltaAmount: number):boolean
Đã Lỗi Thời
SetNetworkOwner(playerInstance: Player):()
SubtractAsync(parts: Instances,collisionfidelity: Enum.CollisionFidelity,renderFidelity: Enum.RenderFidelity):Instance
UnionAsync(parts: Instances,collisionfidelity: Enum.CollisionFidelity,renderFidelity: Enum.RenderFidelity):Instance
Sự Kiện
OutfitChanged():RBXScriptSignal
Đã Lỗi Thời
StoppedTouching(otherPart: BasePart):RBXScriptSignal
Đã Lỗi Thời
Thành viên kế thừa
Được kế thừa bởi
Mẫu mã
Làm mượt CFrame của một Part
local TweenService = game:GetService("TweenService")
-- tạo một phần và mục tiêu
local part = Instance.new("Part", workspace)
part.Size = Vector3.one
part.Anchored = true
part.BrickColor = BrickColor.new("Electric blue")
part.CFrame = CFrame.new(0, 4, 0)
local target = Instance.new("Part", workspace)
target.Name = "Target"
target.Size = Vector3.one * 0.5
target.Anchored = true
target.BrickColor = BrickColor.new("Really red")
target.CFrame = CFrame.new(0, 8, 0)
-- thiết lập một biến để lưu trữ tốc độ
local velocity = CFrame.new()
-- điều chỉnh tốc độ mượt mà
local smoothTime = 0.5
game:GetService("RunService").Stepped:Connect(function(t, dt)
part.CFrame, velocity = TweenService:SmoothDamp(part.CFrame, target.CFrame, velocity, smoothTime, math.huge, dt)
end)

Tài Liệu Tham Khảo API
Thuộc Tính
Anchored
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Anchored:boolean
Mẫu mã
Chuyển Đổi Cố Định Bộ Phận
local part = script.Parent
-- Tạo một ClickDetector để chúng ta có thể biết khi nào bộ phận được nhấp
local cd = Instance.new("ClickDetector", part)
-- Hàm này cập nhật cách mà bộ phận trông dựa trên trạng thái Đã Cố Định của nó
local function updateVisuals()
if part.Anchored then
-- Khi bộ phận đã cố định...
part.BrickColor = BrickColor.new("Đỏ sáng")
part.Material = Enum.Material.DiamondPlate
else
-- Khi bộ phận không còn cố định...
part.BrickColor = BrickColor.new("Vàng sáng")
part.Material = Enum.Material.Wood
end
end
local function onToggle()
-- Chuyển đổi thuộc tính đã cố định
part.Anchored = not part.Anchored
-- Cập nhật trạng thái hình ảnh của khối
updateVisuals()
end
-- Cập nhật, sau đó bắt đầu lắng nghe các cú nhấp chuột
updateVisuals()
cd.MouseClick:Connect(onToggle)

AssemblyAngularVelocity
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.AssemblyAngularVelocity:Vector3

AssemblyCenterOfMass
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.AssemblyCenterOfMass:Vector3

AssemblyLinearVelocity
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.AssemblyLinearVelocity:Vector3

AssemblyMass
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.AssemblyMass:number

AssemblyRootPart
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.AssemblyRootPart:BasePart

AudioCanCollide
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.AudioCanCollide:boolean

BackParamA
Đã Lỗi Thời

BackParamB
Đã Lỗi Thời

BackSurface
Đọc Song Song
BasePart.BackSurface:Enum.SurfaceType

BackSurfaceInput
Đã Lỗi Thời

BottomParamA
Đã Lỗi Thời

BottomParamB
Đã Lỗi Thời

BottomSurface
Đọc Song Song
BasePart.BottomSurface:Enum.SurfaceType

BottomSurfaceInput
Đã Lỗi Thời

BrickColor
Không Sao Chép
Đọc Song Song
BasePart.BrickColor:BrickColor

brickColor
Đã Lỗi Thời

CanCollide
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.CanCollide:boolean
Mẫu mã
Cửa Mờ
-- Dán vào một Script bên trong một phần cao
local part = script.Parent
local OPEN_TIME = 1
-- Cửa có thể được mở vào lúc này không?
local debounce = false
local function open()
part.CanCollide = false
part.Transparency = 0.7
part.BrickColor = BrickColor.new("Đen")
end
local function close()
part.CanCollide = true
part.Transparency = 0
part.BrickColor = BrickColor.new("Xanh sáng")
end
local function onTouch(otherPart)
-- Nếu cửa đã mở rồi, thì không làm gì cả
if debounce then
print("D")
return
end
-- Kiểm tra nếu bị chạm bởi một Humanoid
local human = otherPart.Parent:FindFirstChildOfClass("Humanoid")
if not human then
print("không phải con người")
return
end
-- Thực hiện chuỗi mở cửa
debounce = true
open()
task.wait(OPEN_TIME)
close()
debounce = false
end
part.Touched:Connect(onTouch)
close()

CanQuery
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.CanQuery:boolean

CanTouch
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.CanTouch:boolean

CastShadow
Đọc Song Song
BasePart.CastShadow:boolean

CenterOfMass
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.CenterOfMass:Vector3

CFrame
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.CFrame:CFrame
Mẫu mã
Cài đặt CFrame của Phần
local part = script.Parent:WaitForChild("Part")
local otherPart = script.Parent:WaitForChild("OtherPart")
-- Đặt lại CFrame của phần về (0, 0, 0) mà không có xoay.
-- Điều này đôi khi được gọi là CFrame "danh tính"
part.CFrame = CFrame.new()
-- Đặt vào một vị trí cụ thể (X, Y, Z)
part.CFrame = CFrame.new(0, 25, 10)
-- Giống như trên, nhưng sử dụng một Vector3
local point = Vector3.new(0, 25, 10)
part.CFrame = CFrame.new(point)
-- Đặt CFrame của phần ở một điểm, nhìn vào một điểm khác
local lookAtPoint = Vector3.new(0, 20, 15)
part.CFrame = CFrame.lookAt(point, lookAtPoint)
-- Xoay CFrame của phần theo pi/2 radians trên trục X địa phương
part.CFrame = part.CFrame * CFrame.Angles(math.pi / 2, 0, 0)
-- Xoay CFrame của phần theo 45 độ trên trục Y địa phương
part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(45), 0)
-- Xoay CFrame của phần theo 180 độ trên trục Z toàn cầu (chú ý thứ tự!)
part.CFrame = CFrame.Angles(0, 0, math.pi) * part.CFrame -- Pi radians bằng 180 độ
-- Kết hợp hai CFrames được thực hiện bằng cách sử dụng * (toán tử nhân)
part.CFrame = CFrame.new(2, 3, 4) * CFrame.new(4, 5, 6) --> tương đương với CFrame.new(6, 8, 10)
-- Không giống như nhân đại số, kết hợp CFrame KHÔNG phải giao hoán: a * b không nhất thiết là b * a!
-- Hãy tưởng tượng * như một chuỗi hành động CÓ THỨ TỰ. Ví dụ, các dòng sau sẽ tạo ra CFrames khác nhau:
-- 1) Trượt phần 5 đơn vị trên trục X.
-- 2) Xoay phần 45 độ quanh trục Y của nó.
part.CFrame = CFrame.new(5, 0, 0) * CFrame.Angles(0, math.rad(45), 0)
-- 1) Xoay phần 45 độ quanh trục Y của nó.
-- 2) Trượt phần 5 đơn vị trên trục X.
part.CFrame = CFrame.Angles(0, math.rad(45), 0) * CFrame.new(5, 0, 0)
-- Không có "phép chia CFrame", nhưng thay vào đó đơn giản là "thực hiện phép toán nghịch đảo".
part.CFrame = CFrame.new(4, 5, 6) * CFrame.new(4, 5, 6):Inverse() --> bằng CFrame.new(0, 0, 0)
part.CFrame = CFrame.Angles(0, 0, math.pi) * CFrame.Angles(0, 0, math.pi):Inverse() --> bằng CFrame.Angles(0, 0, 0)
-- Đặt một phần tương đối với phần khác (trong trường hợp này, đặt phần của chúng tôi lên trên otherPart)
part.CFrame = otherPart.CFrame * CFrame.new(0, part.Size.Y / 2 + otherPart.Size.Y / 2, 0)

CollisionGroup
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.CollisionGroup:string
Mẫu mã
PhysicsService:RegisterCollisionGroup
local PhysicsService = game:GetService("PhysicsService")
local collisionGroupBall = "CollisionGroupBall"
local collisionGroupDoor = "CollisionGroupDoor"
-- Đăng ký các nhóm va chạm
PhysicsService:RegisterCollisionGroup(collisionGroupBall)
PhysicsService:RegisterCollisionGroup(collisionGroupDoor)
-- Gán các phần cho các nhóm va chạm
script.Parent.BallPart.CollisionGroup = collisionGroupBall
script.Parent.DoorPart.CollisionGroup = collisionGroupDoor
-- Đặt các nhóm không thể va chạm với nhau và kiểm tra kết quả
PhysicsService:CollisionGroupSetCollidable(collisionGroupBall, collisionGroupDoor, false)
print(PhysicsService:CollisionGroupsAreCollidable(collisionGroupBall, collisionGroupDoor)) --> false

CollisionGroupId
Đã Lỗi Thời

Color
Không Sao Chép
Đọc Song Song
BasePart.Color:Color3
Mẫu mã
Màu cơ thể sức khỏe nhân vật
-- Dán vào một Script trong StarterCharacterScripts
-- Sau đó chơi trò chơi, và tùy chỉnh sức khỏe của nhân vật của bạn
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
-- Tạo một màu bằng cách tweening dựa trên tỷ lệ phần trăm sức khỏe của bạn
-- Màu sẽ chuyển từ 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
Chỉ Đọc
Không Sao Chép
Đọc Song Song
BasePart.CurrentPhysicalProperties:PhysicalProperties

CustomPhysicalProperties
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.CustomPhysicalProperties:PhysicalProperties
Mẫu mã
Đặt Thuộc Tính Vật Lý Tùy Chỉnh
local part = script.Parent
-- Điều này sẽ làm cho phần trở nên nhẹ và đàn hồi!
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
Đã Lỗi Thời

EnableFluidForces
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.EnableFluidForces:boolean

ExtentsCFrame
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.ExtentsCFrame:CFrame

ExtentsSize
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.ExtentsSize:Vector3

Friction
Đã Lỗi Thời

FrontParamA
Đã Lỗi Thời

FrontParamB
Đã Lỗi Thời

FrontSurface
Đọc Song Song
BasePart.FrontSurface:Enum.SurfaceType

FrontSurfaceInput
Đã Lỗi Thời

LeftParamA
Đã Lỗi Thời

LeftParamB
Đã Lỗi Thời

LeftSurface
Đọc Song Song
BasePart.LeftSurface:Enum.SurfaceType

LeftSurfaceInput
Đã Lỗi Thời

LocalTransparencyModifier
Ẩn
Không Sao Chép
Đọc Song Song
BasePart.LocalTransparencyModifier:number

Locked
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Locked:boolean
Mẫu mã
Mở Khóa Đệ Quy
-- Dán vào một Script trong một Mô hình bạn muốn mở khóa
local model = script.Parent
-- Hàm này đệ quy qua cấu trúc cây của một mô hình và mở khóa
-- mọi phần mà nó gặp phải.
local function recursiveUnlock(object)
if object:IsA("BasePart") then
object.Locked = false
end
-- Gọi cùng một hàm trên các đối tượng con của đối tượng
-- Quá trình đệ quy dừng lại nếu một đối tượng không có con
for _, child in pairs(object:GetChildren()) do
recursiveUnlock(child)
end
end
recursiveUnlock(model)

Mass
Chỉ Đọc
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Mass:number

Massless
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Massless:boolean

Material
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Material:Enum.Material

MaterialVariant
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.MaterialVariant:string

Orientation
Ẩn
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Orientation:Vector3
Mẫu mã
Bánh Xe Phần
local part = script.Parent
local INCREMENT = 360 / 20
-- Xoay phần liên tục
while true do
for degrees = 0, 360, INCREMENT do
-- Chỉ đặt xoay trên trục Y
part.Rotation = Vector3.new(0, degrees, 0)
-- Một cách tốt hơn để làm điều này là đặt CFrame
--part.CFrame = CFrame.new(part.Position) * CFrame.Angles(0, math.rad(degrees), 0)
task.wait()
end
end

PivotOffset
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.PivotOffset:CFrame
Mẫu mã
Đặt lại 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)
Kim đồng hồ
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
-- Tạo mặt đồng hồ
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
-- Tạo kim đồng hồ
local hourHand = createHand(7, 1, 0)
local minuteHand = createHand(10, 0.6, 0.1)
local secondHand = createHand(11, 0.2, 0.2)
-- Chạy đồng hồ
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
Ẩn
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Position:Vector3

ReceiveAge
Ẩn
Chỉ Đọc
Không Sao Chép
Đọc Song Song
BasePart.ReceiveAge:number

Reflectance
Đọc Song Song
BasePart.Reflectance:number

ResizeableFaces
Chỉ Đọc
Không Sao Chép
Đọc Song Song
BasePart.ResizeableFaces:Faces
Mẫu mã
Công cụ điều chỉnh kích thước
-- Đặt Script này vào nhiều loại BasePart khác nhau, như
-- Part, TrussPart, WedgePart, CornerWedgePart, v.v.
local part = script.Parent
-- Tạo một đối tượng handles cho phần này
local handles = Instance.new("Handles")
handles.Adornee = part
handles.Parent = part
-- Chỉ định thủ công các mặt áp dụng cho công cụ điều chỉnh này
handles.Faces = Faces.new(Enum.NormalId.Top, Enum.NormalId.Front, Enum.NormalId.Left)
-- Ngược lại, sử dụng các mặt mà phần có thể được thay đổi kích thước.
-- Nếu phần là một TrussPart chỉ với hai kích thước kích thước
-- có chiều dài 2, thì ResizeableFaces sẽ chỉ có hai
-- mặt có thể sử dụng. Đối với các phần khác, tất cả các mặt sẽ được kích hoạt.
handles.Faces = part.ResizeableFaces

ResizeIncrement
Chỉ Đọc
Không Sao Chép
Đọc Song Song
BasePart.ResizeIncrement:number

RightParamA
Đã Lỗi Thời

RightParamB
Đã Lỗi Thời

RightSurface
Đọc Song Song
BasePart.RightSurface:Enum.SurfaceType

RightSurfaceInput
Đã Lỗi Thời

RootPriority
Đọc Song Song
BasePart.RootPriority:number

Rotation
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Rotation:Vector3

RotVelocity
Đã Lỗi Thời

Size
Không Sao Chép
Đọc Song Song
Quyền sử dụng chế độ mô phỏng
BasePart.Size:Vector3
Mẫu mã
Nhà Xây Kim Tự Tháp
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 từ color0 và 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
Đã Lỗi Thời

TopParamA
Đã Lỗi Thời

TopParamB
Đã Lỗi Thời

TopSurface
Đọc Song Song
BasePart.TopSurface:Enum.SurfaceType

TopSurfaceInput
Đã Lỗi Thời

Transparency
Đọc Song Song
BasePart.Transparency:number
Mẫu mã
Cửa Mờ
-- Dán vào một Script bên trong một phần cao
local part = script.Parent
local OPEN_TIME = 1
-- Cửa có thể được mở vào lúc này không?
local debounce = false
local function open()
part.CanCollide = false
part.Transparency = 0.7
part.BrickColor = BrickColor.new("Đen")
end
local function close()
part.CanCollide = true
part.Transparency = 0
part.BrickColor = BrickColor.new("Xanh sáng")
end
local function onTouch(otherPart)
-- Nếu cửa đã mở rồi, thì không làm gì cả
if debounce then
print("D")
return
end
-- Kiểm tra nếu bị chạm bởi một Humanoid
local human = otherPart.Parent:FindFirstChildOfClass("Humanoid")
if not human then
print("không phải con người")
return
end
-- Thực hiện chuỗi mở cửa
debounce = true
open()
task.wait(OPEN_TIME)
close()
debounce = false
end
part.Touched:Connect(onTouch)
close()

Velocity
Đã Lỗi Thời

Phương Pháp
AngularAccelerationToTorque
Quyền sử dụng chế độ mô phỏng
BasePart:AngularAccelerationToTorque(
angAcceleration:Vector3, angVelocity:Vector3
Tham Số
angAcceleration:Vector3
angVelocity:Vector3
Giá Trị Mặc Định: "0, 0, 0"
Lợi Nhuận

ApplyAngularImpulse
Quyền sử dụng chế độ mô phỏng
BasePart:ApplyAngularImpulse(impulse:Vector3):()
Tham Số
impulse:Vector3
Lợi Nhuận
()

ApplyImpulse
Quyền sử dụng chế độ mô phỏng
BasePart:ApplyImpulse(impulse:Vector3):()
Tham Số
impulse:Vector3
Lợi Nhuận
()

ApplyImpulseAtPosition
Quyền sử dụng chế độ mô phỏng
BasePart:ApplyImpulseAtPosition(
impulse:Vector3, position:Vector3
):()
Tham Số
impulse:Vector3
position:Vector3
Lợi Nhuận
()

BreakJoints
Đã Lỗi Thời

breakJoints
Đã Lỗi Thời

CanCollideWith
Ghi Song Song
Quyền sử dụng chế độ mô phỏng
BasePart:CanCollideWith(part:BasePart):boolean
Tham Số
Lợi Nhuận

CanSetNetworkOwnership
Quyền sử dụng chế độ mô phỏng
BasePart:CanSetNetworkOwnership():Tuple
Lợi Nhuận
Mẫu mã
Kiểm tra xem quyền sở hữu mạng của một phần có thể được thiết lập không
local part = workspace:FindFirstChild("Part")
if part and part:IsA("BasePart") then
local canSet, errorReason = part:CanSetNetworkOwnership()
if canSet then
print(part:GetFullName() .. " quyền sở hữu mạng có thể được thay đổi!")
else
warn("Không thể thay đổi quyền sở hữu mạng của " .. part:GetFullName() .. " vì: " .. errorReason)
end
end

GetClosestPointOnSurface
Quyền sử dụng chế độ mô phỏng
BasePart:GetClosestPointOnSurface(position:Vector3):Vector3
Tham Số
position:Vector3
Lợi Nhuận

GetConnectedParts
Ghi Song Song
BasePart:GetConnectedParts(recursive:boolean):{BasePart}
Tham Số
recursive:boolean
Giá Trị Mặc Định: false
Lợi Nhuận

GetJoints
Ghi Song Song
Quyền sử dụng chế độ mô phỏng
BasePart:GetJoints():Instances
Lợi Nhuận
Instances

GetMass
Ghi Song Song
Quyền sử dụng chế độ mô phỏng
BasePart:GetMass():number
Lợi Nhuận
Mẫu mã
Tìm Khối Lượng Của Một Phần
local myPart = Instance.new("Part")
myPart.Size = Vector3.new(4, 6, 4)
myPart.Anchored = true
myPart.Parent = workspace
local myMass = myPart:GetMass()
print("Khối lượng của phần tôi là " .. myMass)

getMass
Đã Lỗi Thời

GetNetworkOwner
Ghi Song Song
Quyền sử dụng chế độ mô phỏng
BasePart:GetNetworkOwner():Instance
Lợi Nhuận

GetNetworkOwnershipAuto
Ghi Song Song
Quyền sử dụng chế độ mô phỏng
BasePart:GetNetworkOwnershipAuto():boolean
Lợi Nhuận

GetNoCollisionConstraints
Quyền sử dụng chế độ mô phỏng
BasePart:GetNoCollisionConstraints():Instances
Lợi Nhuận
Instances

GetRenderCFrame
Đã Lỗi Thời

GetRootPart
Đã Lỗi Thời

GetTouchingParts
Quyền sử dụng chế độ mô phỏng
BasePart:GetTouchingParts():Instances
Lợi Nhuận
Instances

GetVelocityAtPosition
Ghi Song Song
Quyền sử dụng chế độ mô phỏng
BasePart:GetVelocityAtPosition(position:Vector3):Vector3
Tham Số
position:Vector3
Lợi Nhuận

IntersectAsync
Sinh Lợi
Các khả năng: CSG
BasePart:IntersectAsync(
parts:Instances, collisionfidelity:Enum.CollisionFidelity, renderFidelity:Enum.RenderFidelity
Tham Số
parts:Instances
collisionfidelity:Enum.CollisionFidelity
Giá Trị Mặc Định: "Default"
renderFidelity:Enum.RenderFidelity
Giá Trị Mặc Định: "Automatic"
Lợi Nhuận

IsGrounded
Ghi Song Song
Quyền sử dụng chế độ mô phỏng
BasePart:IsGrounded():boolean
Lợi Nhuận

MakeJoints
Đã Lỗi Thời

makeJoints
Đã Lỗi Thời

Resize
Quyền sử dụng chế độ mô phỏng
BasePart:Resize(
normalId:Enum.NormalId, deltaAmount:number
Tham Số
normalId:Enum.NormalId
deltaAmount:number
Lợi Nhuận

resize
Đã Lỗi Thời

SetNetworkOwner
Quyền sử dụng chế độ mô phỏng
BasePart:SetNetworkOwner(playerInstance:Player):()
Tham Số
playerInstance:Player
Giá Trị Mặc Định: "nil"
Lợi Nhuận
()

SetNetworkOwnershipAuto
Quyền sử dụng chế độ mô phỏng
BasePart:SetNetworkOwnershipAuto():()
Lợi Nhuận
()

SubtractAsync
Sinh Lợi
Các khả năng: CSG
BasePart:SubtractAsync(
parts:Instances, collisionfidelity:Enum.CollisionFidelity, renderFidelity:Enum.RenderFidelity
Tham Số
parts:Instances
collisionfidelity:Enum.CollisionFidelity
Giá Trị Mặc Định: "Default"
renderFidelity:Enum.RenderFidelity
Giá Trị Mặc Định: "Automatic"
Lợi Nhuận
Mẫu mã
BasePart:SubtractAsync()
local Workspace = game:GetService("Workspace")
local mainPart = script.Parent.PartA
local otherParts = { script.Parent.PartB, script.Parent.PartC }
-- Thực hiện phép trừ
local success, newSubtract = pcall(function()
return mainPart:SubtractAsync(otherParts)
end)
-- Nếu phép toán thành công, đặt nó ở cùng vị trí và cha nó vào workspace
if success and newSubtract then
newSubtract.Position = mainPart.Position
newSubtract.Parent = Workspace
end
-- Hủy các phần gốc vẫn còn nguyên vẹn sau phép toán
mainPart:Destroy()
for _, part in otherParts do
part:Destroy()
end

TorqueToAngularAcceleration
Quyền sử dụng chế độ mô phỏng
BasePart:TorqueToAngularAcceleration(
torque:Vector3, angVelocity:Vector3
Tham Số
torque:Vector3
angVelocity:Vector3
Giá Trị Mặc Định: "0, 0, 0"
Lợi Nhuận

UnionAsync
Sinh Lợi
Các khả năng: CSG
BasePart:UnionAsync(
parts:Instances, collisionfidelity:Enum.CollisionFidelity, renderFidelity:Enum.RenderFidelity
Tham Số
parts:Instances
collisionfidelity:Enum.CollisionFidelity
Giá Trị Mặc Định: "Default"
renderFidelity:Enum.RenderFidelity
Giá Trị Mặc Định: "Automatic"
Lợi Nhuận
Mẫu mã
BasePart:UnionAsync()
local Workspace = game:GetService("Workspace")
local mainPart = script.Parent.PartA
local otherParts = { script.Parent.PartB, script.Parent.PartC }
-- Thực hiện phép hợp nhất
local success, newUnion = pcall(function()
return mainPart:UnionAsync(otherParts)
end)
-- Nếu phép toán thành công, đặt nó ở cùng một vị trí và gán cho workspace
if success and newUnion then
newUnion.Position = mainPart.Position
newUnion.Parent = Workspace
end
-- Huỷ các phần gốc vẫn còn nguyên vẹn sau phép toán
mainPart:Destroy()
for _, part in otherParts do
part:Destroy()
end

Sự Kiện
LocalSimulationTouched
Đã Lỗi Thời

OutfitChanged
Đã Lỗi Thời

StoppedTouching
Đã Lỗi Thời

Touched
BasePart.Touched(otherPart:BasePart):RBXScriptSignal
Tham Số
otherPart:BasePart
Mẫu mã
Số lượng phần chạm
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("Bắt đầu chạm: " .. otherPart.Name)
numTouchingParts = numTouchingParts + 1
tl.Text = numTouchingParts
end
local function onTouchEnded(otherPart)
print("Kết thúc chạm: " .. otherPart.Name)
numTouchingParts = numTouchingParts - 1
tl.Text = numTouchingParts
end
part.Touched:Connect(onTouch)
part.TouchEnded:Connect(onTouchEnded)
Mô Hình Được Chạm
local model = script.Parent
local function onTouched(otherPart)
-- Bỏ qua các trường hợp mô hình chạm vào chính nó
if otherPart:IsDescendantOf(model) then
return
end
print(model.Name .. " đã va chạm với " .. 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
Tham Số
otherPart:BasePart
Mẫu mã
Số lượng phần chạm
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("Bắt đầu chạm: " .. otherPart.Name)
numTouchingParts = numTouchingParts + 1
tl.Text = numTouchingParts
end
local function onTouchEnded(otherPart)
print("Kết thúc chạm: " .. otherPart.Name)
numTouchingParts = numTouchingParts - 1
tl.Text = numTouchingParts
end
part.Touched:Connect(onTouch)
part.TouchEnded:Connect(onTouchEnded)

©2026 Roblox Corporation. Roblox, logo Roblox và Powering Imagination là các nhãn hiệu đã đăng ký và chưa đăng ký của chúng tôi tại Hoa Kỳ và các quốc gia khác.