เรียนรู้
Engine Class
Debris
ไม่สามารถสร้าง
บริการ

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


สรุป
คุณสมบัติ
MaxItems:number
เลิกใช้แล้ว
วิธีการ
AddItem(item: Instance,lifetime: number):()
addItem(item: Instance,lifetime: number):()
เลิกใช้แล้ว
สมาชิกที่ได้รับทอด
ตัวอย่างโค้ด
Debris เพิ่มรายการ
local Debris = game:GetService("Debris")
local ball = Instance.new("Part")
ball.Anchored = false
ball.Shape = Enum.PartType.Ball
ball.TopSurface = Enum.SurfaceType.Smooth
ball.BottomSurface = Enum.SurfaceType.Smooth
ball.Size = Vector3.new(1, 1, 1)
local RNG = Random.new()
local MAX_VELOCITY = 10
while true do
local newBall = ball:Clone()
newBall.BrickColor = BrickColor.random()
newBall.CFrame = CFrame.new(0, 30, 0)
newBall.Velocity =
Vector3.new(RNG:NextNumber(-MAX_VELOCITY, MAX_VELOCITY), 0, RNG:NextNumber(-MAX_VELOCITY, MAX_VELOCITY))
newBall.Parent = game.Workspace
Debris:AddItem(newBall, 2)
task.wait(0.1)
end

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
MaxItems
เลิกใช้แล้ว

วิธีการ
AddItem
ความสามารถ: Basic
Debris:AddItem(
item:Instance, lifetime:number
):()
พารามิเตอร์
lifetime:number
ค่าเริ่มต้น: 10
ส่งค่ากลับ
()
ตัวอย่างโค้ด
Debris เพิ่มรายการ
local Debris = game:GetService("Debris")
local ball = Instance.new("Part")
ball.Anchored = false
ball.Shape = Enum.PartType.Ball
ball.TopSurface = Enum.SurfaceType.Smooth
ball.BottomSurface = Enum.SurfaceType.Smooth
ball.Size = Vector3.new(1, 1, 1)
local RNG = Random.new()
local MAX_VELOCITY = 10
while true do
local newBall = ball:Clone()
newBall.BrickColor = BrickColor.random()
newBall.CFrame = CFrame.new(0, 30, 0)
newBall.Velocity =
Vector3.new(RNG:NextNumber(-MAX_VELOCITY, MAX_VELOCITY), 0, RNG:NextNumber(-MAX_VELOCITY, MAX_VELOCITY))
newBall.Parent = game.Workspace
Debris:AddItem(newBall, 2)
task.wait(0.1)
end

addItem
เลิกใช้แล้ว

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ