เรียนรู้
Engine Class
Beam

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


สรุป
วิธีการ
สมาชิกที่ได้รับทอด
ตัวอย่างโค้ด
การสร้าง Beam จากศูนย์
-- สร้างการเชื่อมต่อ
local att0 = Instance.new("Attachment")
local att1 = Instance.new("Attachment")
-- พ่อแม่ไปยังพื้นดิน (สามารถเป็นส่วนอื่นได้)
att0.Parent = workspace.Terrain
att1.Parent = workspace.Terrain
-- ตำแหน่งการเชื่อมต่อ
att0.Position = Vector3.new(0, 10, 0)
att1.Position = Vector3.new(0, 10, 10)
-- สร้าง beam
local beam = Instance.new("Beam")
beam.Attachment0 = att0
beam.Attachment1 = att1
-- คุณสมบัติรูปลักษณ์
beam.Color = ColorSequence.new({ -- ลำดับสีที่เปลี่ยนจากสีขาวเป็นสีน้ำเงิน
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 255, 255)),
})
beam.LightEmission = 1 -- ใช้การผสมแบบเพิ่ม
beam.LightInfluence = 0 -- beam ไม่ได้รับอิทธิพลจากแสง
beam.Texture = "rbxasset://textures/particles/sparkles_main.dds" -- เท็กซ์เจอร์ประกายที่สร้างไว้
beam.TextureMode = Enum.TextureMode.Wrap -- ห่อหุ้มเพื่อให้ความยาวสามารถตั้งค่าได้โดย TextureLength
beam.TextureLength = 1 -- เท็กซ์เจอร์ที่ทำซ้ำยาว 1 stud
beam.TextureSpeed = 1 -- ความเร็วเท็กซ์เจอร์ช้า
beam.Transparency = NumberSequence.new({ -- beam จะจางหายไปที่ปลาย
NumberSequenceKeypoint.new(0, 0),
NumberSequenceKeypoint.new(0.8, 0),
NumberSequenceKeypoint.new(1, 1),
})
beam.ZOffset = 0 -- แสดงที่ตำแหน่งของ beam โดยไม่มีการเลื่อน
-- คุณสมบัติรูปทรง
beam.CurveSize0 = 2 -- สร้าง beam ที่โค้ง
beam.CurveSize1 = -2 -- สร้าง beam ที่โค้ง
beam.FaceCamera = true -- beam มองเห็นได้จากทุกมุม
beam.Segments = 10 -- ความละเอียดของโค้งเริ่มต้น
beam.Width0 = 0.2 -- เริ่มต้นเล็ก
beam.Width1 = 2 -- สิ้นสุดใหญ่
-- พ่อแม่ beam
beam.Enabled = true
beam.Parent = att0

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
Attachment0
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Attachment0:Attachment

Attachment1
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Attachment1:Attachment

Brightness
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Brightness:number

Color
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Color:ColorSequence

CurveSize0
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.CurveSize0:number
ตัวอย่างโค้ด
ขนาดโค้ง0
local part = Instance.new("Part")
part.Anchored = true
part.Parent = workspace
local attachment0 = Instance.new("Attachment")
attachment0.Parent = part
local attachment1 = Instance.new("Attachment")
attachment1.Parent = part
local Beam = Instance.new("Beam")
Beam.Attachment0 = attachment0
Beam.Attachment1 = attachment1
Beam.Parent = part
local controlPoint2 = Beam.Attachment0.WorldPosition + (Beam.Attachment0.CFrame.RightVector * Beam.CurveSize0)

CurveSize1
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.CurveSize1:number
ตัวอย่างโค้ด
ขนาดโค้ง1
local part = Instance.new("Part")
part.Anchored = true
part.Parent = workspace
local attachment0 = Instance.new("Attachment")
attachment0.Parent = part
local attachment1 = Instance.new("Attachment")
attachment1.Parent = part
local Beam = Instance.new("Beam")
Beam.Attachment0 = attachment0
Beam.Attachment1 = attachment1
Beam.Parent = part
local controlPoint3 = Beam.Attachment1.WorldPosition - (Beam.Attachment1.CFrame.RightVector * Beam.CurveSize1)

Enabled
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Enabled:boolean

FaceCamera
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.FaceCamera:boolean

LightEmission
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.LightEmission:number

LightInfluence
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.LightInfluence:number

LocalTransparencyModifier
ซ่อนอยู่
ไม่ซ้ำ
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.LocalTransparencyModifier:number

Segments
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Segments:number

Texture
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Texture:ContentId

TextureLength
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.TextureLength:number

TextureMode
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.TextureMode:Enum.TextureMode

TextureSpeed
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.TextureSpeed:number

Transparency
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Transparency:NumberSequence

Width0
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Width0:number

Width1
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.Width1:number

ZOffset
อ่านพร้อมๆ กัน
ความสามารถ: Basic
Beam.ZOffset:number
ตัวอย่างโค้ด
การซ้อนทับของลำแสง
-- สร้างลำแสง
local beam1 = Instance.new("Beam")
beam1.Color = ColorSequence.new(Color3.new(1, 0, 0))
beam1.FaceCamera = true
beam1.Width0 = 3
beam1.Width1 = 3
local beam2 = Instance.new("Beam")
beam2.Color = ColorSequence.new(Color3.new(0, 1, 0))
beam2.FaceCamera = true
beam2.Width0 = 2
beam2.Width1 = 2
local beam3 = Instance.new("Beam")
beam3.Color = ColorSequence.new(Color3.new(0, 0, 1))
beam3.FaceCamera = true
beam3.Width0 = 1
beam3.Width1 = 1
-- ซ้อนลำแสง
beam1.ZOffset = 0
beam2.ZOffset = 0.01
beam3.ZOffset = 0.02
-- สร้างการเชื่อมต่อ
local attachment0 = Instance.new("Attachment")
attachment0.Position = Vector3.new(0, -10, 0)
attachment0.Parent = workspace.Terrain
local attachment1 = Instance.new("Attachment")
attachment1.Position = Vector3.new(0, 10, 0)
attachment1.Parent = workspace.Terrain
-- เชื่อมต่อลำแสง
beam1.Attachment0 = attachment0
beam1.Attachment1 = attachment1
beam2.Attachment0 = attachment0
beam2.Attachment1 = attachment1
beam3.Attachment0 = attachment0
beam3.Attachment1 = attachment1
-- ตั้งค่าให้ลำแสงเป็นบุตร
beam1.Parent = workspace
beam2.Parent = workspace
beam3.Parent = workspace

วิธีการ
SetTextureOffset
ความสามารถ: Basic
Beam:SetTextureOffset(offset:number):()
พารามิเตอร์
offset:number
ค่าเริ่มต้น: 0
ส่งค่ากลับ
()

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