Properties
Attachment
|
The |
Attachment
|
The |
ColorSequence
|
Determines the color of the |
float
|
Determines, along with |
float
|
Determines, along with |
bool
|
Determines whether the |
bool
|
Determines whether the |
float
|
Determines to what degree the colors of the |
float
|
Determines the degree to which the |
int
|
Sets how many straight segments the |
Content
|
The content ID of the texture to be displayed on the |
float
|
Sets the length of the |
TextureMode
|
Determines the manner in which the |
float
|
Determines the speed at which the |
NumberSequence
|
Determines the transparency of the |
float
|
The width in studs of the |
float
|
The width in studs of the |
float
|
The distance, in studs, the |
bool
|
Determines if an |
string
[ReadOnly]
[NotReplicated]
|
A read-only string representing the class this |
int
[Hidden]
[ReadOnly]
[NotReplicated]
[Deprecated]
|
The cost of saving the instance using data persistence. |
string
|
A non-unique identifier of the |
Instance
[NotReplicated]
|
Determines the hierarchical parent of the |
bool
[Hidden]
|
A deprecated property that used to protect |
bool
[Hidden]
[NotReplicated]
[Deprecated]
|
string
[ReadOnly]
[NotReplicated]
[Deprecated]
|
Functions
void
|
Sets the current offset of the |
void
|
This function destroys all of an |
Instance
|
Create a copy of an object and all its descendants, ignoring objects that are not |
void
|
Sets the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first ancestor of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Returns the first child of the |
Instance
|
Variant
|
Returns the attribute which has been assigned to the given name |
RBXScriptSignal
|
Returns an event that fires when the given attribute changes |
Dictionary
|
Returns a dictionary of string → variant pairs for each of the |
Objects
|
Returns an array containing all of the |
string
[NotBrowsable]
|
Returns a coded string of the |
Array
[CustomLuaState]
|
Returns an array containing all of the descendants of the instance |
string
|
Returns a string describing the |
RBXScriptSignal
|
Get an event that fires when a given property of an object changes. |
bool
[CustomLuaState]
|
Returns true if an |
bool
|
Returns true if an |
bool
|
Returns true if an |
void
[Deprecated]
|
Sets the object’s Parent to nil, and does the same for all its descendants. |
void
|
Sets the attribute with the given name to the given value |
Instance
[CustomLuaState]
[CanYield]
|
Returns the child of the |
Objects
[Deprecated]
|
Returns an array of the object’s children. |
Instance
[Deprecated]
|
void
[Deprecated]
|
Instance
[Deprecated]
|
Objects
[Deprecated]
|
bool
[Deprecated]
[CustomLuaState]
|
bool
[Deprecated]
|
void
[Deprecated]
|
Events
RBXScriptSignal
|
Fires when the |
RBXScriptSignal
|
Fires whenever an attribute is changed on the |
RBXScriptSignal
|
Fired immediately after a property of an object changes. |
RBXScriptSignal
|
Fires when an object is parented to this |
RBXScriptSignal
|
Fires when a child is removed from this |
RBXScriptSignal
|
Fires when a descendant is added to the |
RBXScriptSignal
|
Fires immediately before a descendant of the |
RBXScriptSignal
[Deprecated]
|
Code Samples
Create a chain of beams between parts
This code sample includes a function that will connect the given BasePart
s together with Beam
s.
local function connectParts(...) -- build an array of parts given local parts = {...} -- make sure there is more than one part if #parts > 1 then -- create a template beam local beam = Instance.new("Beam") -- can change beam properties here -- create an initial attachment in the first part local lastAttachment = Instance.new("Attachment", parts[1]) -- iterate through parts from the second part for i = 2, #parts do local part = parts[i] -- create an attachment in the part local nextAttachment = Instance.new("Attachment", part) -- hook the beam up local newBeam = beam:Clone() newBeam.Attachment0 = lastAttachment newBeam.Attachment1 = nextAttachment newBeam.Parent = lastAttachment -- set the last attachment lastAttachment = nextAttachment end end end
Creating a Beam From Scratch
This code sample demonstrates how a Beam
effect can be created from scratch by creating a Beam
, setting all of its properties and configuring it’s Attachment
s. See below for an image of the final result:
-- create attachments local att0 = Instance.new("Attachment") local att1 = Instance.new("Attachment") -- parent to terrain (can be part instead) att0.Parent = workspace.Terrain att1.Parent = workspace.Terrain -- position attachments att0.Position = Vector3.new(0, 10, 0) att1.Position = Vector3.new(0, 10, 10) -- create beam local beam = Instance.new("Beam") beam.Attachment0 = att0 beam.Attachment1 = att1 -- appearance properties beam.Color = ColorSequence.new({ -- a color sequence shifting from white to blue ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)), ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 255, 255)) } ) beam.LightEmission = 1 -- use additive blending beam.LightInfluence = 0 -- beam not influenced by light beam.Texture = "rbxasset://textures/particles/sparkles_main.dds" -- a built in sparkle texture beam.TextureMode = Enum.TextureMode.Wrap -- wrap so length can be set by TextureLength beam.TextureLength = 1 -- repeating texture is 1 stud long beam.TextureSpeed = 1 -- slow texture speed beam.Transparency = NumberSequence.new({ -- beam fades out at the end NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(0.8, 0), NumberSequenceKeypoint.new(1, 1) } ) beam.ZOffset = 0 -- render at the position of the beam without offset -- shape properties beam.CurveSize0 = 2 -- create a curved beam beam.CurveSize1 = -2 -- create a curved beam beam.FaceCamera = true -- beam is visible from every angle beam.Segments = 10 -- default curve resolution beam.Width0 = 0.2 -- starts small beam.Width1 = 2 -- ends big -- parent beam beam.Enabled = true beam.Parent = att0