Class · inherits Instance
Beam
Connects two Attachments by drawing a texture between them.
About Beam
A Beam object connects two Attachments by drawing a
texture between them.
To display, a beam must be a descendant of the Workspace with its
Attachment0 and Attachment1
properties set to Attachments also descending from the
Workspace.
The beam's appearance can be customized using the range of properties outlined below. Also see the Beams guide for visual examples.
Beam Curvature
Beams are configured to use a cubic Bézier curve formed by four control
points. This means they are not constrained to straight lines and the curve of
the beam can be modified by changing CurveSize0,
CurveSize1, and the orientation of the beam's
Attachments.
- P0 — The start of the beam; position of
Attachment0. - P1 —
CurveSize0studs away fromAttachment0, in the positive X direction ofAttachment0. - P2 —
CurveSize1studs away fromAttachment1, in the negative X direction ofAttachment1. - P3 — The end of the beam; position of
Attachment1
Properties 21
Attachment0
: AttachmentTheAttachmentthe beam originates from.The
Attachmentthe beam originates from. This attachment is the first control point on the beam's cubic Bézier curve; its orientation, alongside theCurveSize0property, determines the position of the second control point. See Beams for more details.For the
Attachmentwhere the beam ends, seeAttachment1.Attachment1
: AttachmentTheAttachmentthe beam ends at.The
Attachmentthe beam ends at. This attachment is the fourth and final control point on the beam's cubic Bézier curve; its orientation, alongside theCurveSize1property, determines the position of the third control point. See Beams for more details.For the
Attachmentwhere the beam originates from, seeAttachment0.Brightness
: floatScales the light emitted from the beam whenLightInfluenceis less than 1.Scales the light emitted from the beam when
LightInfluenceis less than 1. This property is 1 by default and can set to any number within the range of 0 to 10000. Increasing the value ofLightInfluencedecreases the effect of this property's value.Color
: ColorSequenceDetermines the color of the beam across itsSegments.Determines the color of the beam across its
Segments. IfTextureis set, this color will be applied to the beam's texture. If noTextureis set, theBeamwill appear as a solid line colored in accordance with this property.This property is a
ColorSequence, allowing the color to be configured to vary across the length of the beam. Consider the followingColorSequencewhich, when applied to a beam, would yield the pictured result.local colorSequence = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)), -- Red ColorSequenceKeypoint.new(0.5, Color3.fromRGB(0, 188, 203)), -- Cyan ColorSequenceKeypoint.new(1, Color3.fromRGB(196, 0, 255)), -- Purple } )Note the beam's coloration also depends on the number of
SegmentstheBeamhas. Each segment of the beam can only show a transition between two colors. Therefore aBeamwill need to have at leastn-1segments in order for the color to display correctly, wherenis the number ofColorSequenceKeypointsin theColorSequence.CurveSize0
: floatDetermines, along withAttachment0, the position of the second control point in the beam's Bézier curve.Determines, along with
Attachment0, the position of the second control point in the beam's Bézier curve. See Beams for more details.The position of this point can be determined by the following equation:
CurveSize1
: floatDetermines, along withAttachment1, the position of the third control point in the beam's Bézier curve.Determines, along with
Attachment1, the position of the third control point in the beam's Bézier curve. See Beams for more details.The position of this point can be determined by the following equation:
Enabled
: booleanDetermines whether the beam is visible or not.Determines whether the beam is visible or not.
When this property is set to false, the beam's
Segmentswill not be displayed.FaceCamera
: booleanDetermines whether theSegmentsof the beam will always face the camera, regardless of its orientation.A
Beamis a 2D projection existing in 3D space, meaning that it may not be visible from every angle. The FaceCamera property, when set totrue, ensures that the beam always faces theCurrentCamera, regardless of its orientation.LightEmission
: floatDetermines to what degree the colors of the beam are blended with the colors behind it.Determines to what degree the colors of the beam are blended with the colors behind it. It should be set in the range of 0 to 1. A value of 0 uses normal blending modes and a value of 1 uses additive blending.
This property should not be confused with
LightInfluencewhich determines how the beam is affected by environmental light.This property does not cause the beam to light the environment.
LightInfluence
: floatDetermines the degree to which the beam is influenced by the environment's lighting.Determines the degree to which the beam is influenced by the environment's lighting, clamped between 0 and 1. When 0, the beam will be unaffected by the environment's lighting. When 1, it will be fully affected by lighting as a
BasePartwould be.See also
LightEmissionwhich specifies to what degree the colors of the beam are blended with the colors behind it.LocalTransparencyModifier
: floatHiddenNotReplicatedDetermines a multiplier forBeam.Transparencythat is only visible to the local client.The
LocalTransparencyModifierproperty is a multiplier applied to the beam'sTransparencythat is only visible to the local client. It does not replicate from client to server and is useful for when a beam should not render for a specific client.Uses the same formula as
BasePart.LocalTransparencyModifier.A value of
0(default) has no effect on the beam's transparency. A value of1makes the beam completely invisible to the local client regardless of itsTransparencyvalue.Segments
: intSets how many straight segments the beam is made up of.Rather than being a perfect curve, a beam is made up of straight segments. The more segments, the higher the resolution of the curve. The Segments property sets how many straight segments the beam is made up of, with a default value of 10.
Note that the
ColorandTransparencyproperties require a certain number of segments to display correctly. This is because each segment can only show a transition between two colors or transparencies. Therefore aBeamrequires at leastn-1segments to display correctly, wherenis the number of keypoint associated with the beam'sColorandTransparency.Texture
: ContentIdThe content ID of the texture to be displayed on the beam.The content ID of the texture to be displayed on the beam. If this property is not set, the beam will be displayed as a solid line; this also occurs when the texture is set to an invalid content ID or the image associated with the texture has not yet loaded.
The appearance of the texture can be further modified by other beam properties including
ColorandTransparency.Scaling of the texture is determined by the
TextureMode,TextureLength,Width0, andWidth1properties.TextureContent
: ContentThe texture displayed on the beam. Supports asset URIs.The texture displayed on the beam. Supports asset URIs.
If this property is set to
Content.none, the beam displays as a solid line colored by itsColorproperty. The appearance of the texture can be further modified byColor,Transparency, and scaling is determined byTextureMode,TextureLength,Width0, andWidth1.TextureLength
: floatSets the length of the beam's texture, dependent onTextureMode.TextureMode
: TextureModeDetermines the manner in which theTexturescales and repeats.This property, alongside
TextureLength, determines how a beam'sTexturerepeats.When set to
TextureMode.WraporTextureMode.Static, the texture repetitions will equal the beam's overall length (in studs) divided by itsTextureLength.When set to
TextureMode.Stretch, the texture will repeatTextureLengthtimes across the beam's overall length.TextureSpeed
: floatDetermines the speed at which theTextureimage moves along the beam.Sets the number of texture cycles per second at which the
Textureimage moves along the beam, where one cycle is a full traversal of the texture's UV range. When this property is a positive value, the beam's texture will move fromAttachment0toAttachment1. This direction can be inverted by setting this property to a negative number. The default value is1.How far one cycle travels along the beam in studs depends on
TextureModeandTextureLength.Examples
-2— Texture scrolls fromAttachment1towardAttachment0, completing two cycles per second.0— Texture is static.1— Texture scrolls fromAttachment0towardAttachment1, completing one cycle per second (default).2— Texture scrolls fromAttachment0towardAttachment1, completing two cycles per second.
Transparency
: NumberSequenceDetermines the transparency of the beam across its segments.Determines the transparency of the beam across its segments. This property is a
NumberSequence, allowing the transparency to be configured to vary across the length of the beam.Consider the following
NumberSequencewhich, when applied to a beam, would yield the pictured result.local numberSequence = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0), -- Opaque NumberSequenceKeypoint.new(0.5, 1), -- Transparent NumberSequenceKeypoint.new(1, 0), -- Opaque } )Note that the beam's transparency also depends on the number of
Segments. Each segment of the beam can only show a transition between two transparencies. Therefore a beam will need to have at leastn-1segments in order to display correctly, wherenis the number ofNumberSequenceKeypointsin theNumberSequence.Width0
: floatThe width of the beam at its origin (Attachment0), in studs.The width of the beam at its origin (
Attachment0), in studs. The beam's width will change linearly toWidth1studs at its end (Attachment1).Width1
: floatThe width of the beam at its end (Attachment1), in studs.The width of the beam at its end (
Attachment1), in studs. The beam's width will change linearly fromWidth0studs at its origin (Attachment0).ZOffset
: floatThe distance, in studs, the beam display is offset relative to theCurrentCamera.The distance, in studs, the beam display is offset relative to the
CurrentCamera. When 0, the beam will be displayed in its standard position betweenAttachment0andAttachment1. ZOffset can be either positive or negative.This property is particularly useful to avoid "Z‑fighting" when using multiple
Beamsbetween the sameAttachments.
Methods 1
SetTextureOffset
(offset: float = 0) → ()Sets the current offset of the beam's texture cycle.The offset of a beam's texture cycle represents the progress of its texture animation. This method sets the current offset of the beam's texture cycle; hence, it can be used to reset the cycle by passing
0as theoffsetparameter.Notes
- The given
offsetparameter is expected to be a value between 0 and 1, but greater values can be used. - The texture cycle wraps at 0 and 1, meaning the texture is in the same position when the offset is at 0 or 1.
- If the
Textureproperty is not set, this method does nothing. - Increasing the offset will act in the inverse direction to the
TextureSpeedproperty, meaning it will move the texture in the opposite direction to the direction the texture animates whenTextureSpeedis greater than 0.
- The given
Beam also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.