Reference API Roblox

Engine API

Website

Related

Reference API Roblox

Beam

Connects two Attachments by drawing a texture between them.

Member index 21

HistoryMember
553Attachment0: Attachment
553Attachment1: Attachment
553Brightness: float
553Color: ColorSequence
553CurveSize0: float
553CurveSize1: float
553Enabled: bool
553FaceCamera: bool
553LightEmission: float
553LightInfluence: float
553Segments: int
645Texture: ContentId
553TextureLength: float
553TextureMode: TextureMode
553TextureSpeed: float
553Transparency: NumberSequence
553Width0: float
553Width1: float
553ZOffset: float
573SetTextureOffset(offset: float = 0): null
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

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.

Beam curvature diagram

History 82

Members 21

Attachment0

TypeDefault
Attachment

The Attachment the beam originates from. This attachment is the first control point on the beam's cubic Bézier curve; its orientation, alongside the CurveSize0 property, determines the position of the second control point. See Beams for more details.

For the Attachment where the beam ends, see Attachment1.

History 5

Attachment1

TypeDefault
Attachment

The Attachment the beam ends at. This attachment is the fourth and final control point on the beam's cubic Bézier curve; its orientation, alongside the CurveSize1 property, determines the position of the third control point. See Beams for more details.

For the Attachment where the beam originates from, see Attachment0.

History 5

Brightness

TypeDefault
float1

Scales the light emitted from the beam when LightInfluence is 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 of LightInfluence decreases the effect of this property's value.

History 2

Color

TypeDefault
ColorSequence0 1 1 1 0 1 1 1 1 0

Determines the color of the beam across its Segments. If Texture is set, this color will be applied to the beam's texture. If no Texture is set, the Beam will 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 following ColorSequence which, when applied to a beam, would yield the pictured result.

1
2
3
4
5
6
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 Segments the Beam has. Each segment of the beam can only show a transition between two colors. Therefore a Beam will need to have at least n-1 segments in order for the color to display correctly, where n is the number of ColorSequenceKeypoints in the ColorSequence.

History 4

CurveSize0

TypeDefault
float0

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:

1
local controlPoint2 = Beam.Attachment0.WorldPosition + (Beam.Attachment0.CFrame.RightVector * Beam.CurveSize0)

History 4

CurveSize1

TypeDefault
float0

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:

1
local controlPoint3 = Beam.Attachment1.WorldPosition - (Beam.Attachment1.CFrame.RightVector * Beam.CurveSize1)

History 4

Enabled

TypeDefault
booltrue

Determines whether the beam is visible or not.

When this property is set to false, the beam's Segments will not be displayed.

History 4

FaceCamera

TypeDefault
boolfalse

A Beam is a 2D projection existing in 3D space, meaning that it may not be visible from every angle. The FaceCamera property, when set to true, ensures that the beam always faces the CurrentCamera, regardless of its orientation.

History 4

LightEmission

TypeDefault
float0

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 LightInfluence which determines how the beam is affected by environmental light.

This property does not cause the beam to light the environment.

History 4

LightInfluence

TypeDefault
float0

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 BasePart would be.

See also LightEmission which specifies to what degree the colors of the beam are blended with the colors behind it.

History 4

Segments

TypeDefault
int10

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 Color and Transparency properties 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 a Beam requires at least n-1 segments to display correctly, where n is the number of keypoint associated with the beam's Color and Transparency.

History 4

SetTextureOffset

Parameters (1)Default
offsetfloat0
Returns (1)
null

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 0 as the offset parameter.

Notes

  • The given offset parameter 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 Texture property is not set, this method does nothing.
  • Increasing the offset will act in the inverse direction to the TextureSpeed property, meaning it will move the texture in the opposite direction to the direction the texture animates when TextureSpeed is greater than 0.

History 3

Texture

TypeDefault
ContentId

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 Color and Transparency.

Scaling of the texture is determined by the TextureMode, TextureLength, Width0, and Width1 properties.

History 4

TextureLength

TypeDefault
float1

Sets the length of the beam's texture, dependent on TextureMode.

History 4

TextureMode

TypeDefault
TextureModeStretch

This property, alongside TextureLength, determines how a beam's Texture repeats.

When set to TextureMode.Wrap or TextureMode.Static, the texture repetitions will equal the beam's overall length (in studs) divided by its TextureLength.

TextureMode diagram with Wrap mode

When set to TextureMode.Stretch, the texture will repeat TextureLength times across the beam's overall length.

TextureMode diagram with Stretch mode

History 5

TextureSpeed

TypeDefault
float1

Determines the speed at which the Texture image moves along the beam. When this property is a positive value, the beam's texture will move from Attachment0 to Attachment1. This direction can be inverted by setting this property to a negative number.

History 4

Transparency

TypeDefault
NumberSequence0 0.5 0 1 0.5 0

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 NumberSequence which, when applied to a beam, would yield the pictured result.

1
2
3
4
5
6
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 least n-1 segments in order to display correctly, where n is the number of NumberSequenceKeypoints in the NumberSequence.

History 4

Width0

TypeDefault
float1

The width of the beam at its origin (Attachment0), in studs. The beam's width will change linearly to Width1 studs at its end (Attachment1).

History 4

Width1

TypeDefault
float1

The width of the beam at its end (Attachment1), in studs. The beam's width will change linearly from Width0 studs at its origin (Attachment0).

History 4

ZOffset

TypeDefault
float0

The distance, in studs, the beam display is offset relative to the CurrentCamera. When 0, the beam will be displayed in its standard position between Attachment0 and Attachment1. ZOffset can be either positive or negative.

This property is particularly useful to avoid "Z‑fighting" when using multiple Beams between the same Attachments.

History 4

Settings