# Is there a way to get the position of points in a beam?

Is there a way to get info of all the points/segments of a beam? Like, for example:

``````local segments = Beam:GetSegments()

for i, seg in segments do
print(seg.Position)
end
``````

Or something similar.

Any help is highly appreciated!

You have to write your own code for it.

Roblox beams use the Cubic Bezier Curve.

## My sample code for the demo. I use my own debug module system to draw the dots.

``````local DEBUG = require(game.ReplicatedStorage.GameLib.DebugModule)

local beam = script.Parent.Beam

local function beamPos(beam: Beam, t: number)
-- get the bezier position of the beam given the percentage t
local p0 = beam.Attachment0.WorldCFrame
local p1 = p0 * CFrame.new(1 * beam.CurveSize0,0,0)
local p3 = beam.Attachment1.WorldCFrame
local p2 = p3 * CFrame.new(-1 * beam.CurveSize1,0,0)

p0 = p0.Position
p1 = p1.Position
p2 = p2.Position
p3 = p3.Position

return (1 - t)^3 * p0 + 3 * (1 - t)^2 * t * p1 + 3 * (1 - t) * t^2 * p2 + t^3 * p3
end