PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Color

Trail

ColorSequence

The color of a Trail can be set with the effect’s Color property. This property determines what color the segments of the trail will have through their Trail/Lifetime.

Color is a DataType/ColorSequence, which means that the segments in a trail can shift between several colors. Note that if the color for a trail changes after some of the trail segments have been drawn, all of the old segments will be updated to match the new colors.

If a trail has a Trail/Texture then the Color property will tint that texture.

Trails with tinted textures

Any transparent components of a texture will not be tinted.


Code Samples


Changing a Trail Color As It Is Drawing

This example changes the color of the trail as it is being drawn. Initially, the color of the trail is set to blue (Color3.new(0,255,255)). After waiting for 1.5 seconds, the color of the trail is set to red (Color3.new(255,0,0)).

The gif below displays what the output of the example should look like.

Trail color switch from blue to red.

local trailEffect = script.Parent
 
local firstColor = Color3.new(0, 255, 255)
local secondColor = Color3.new(255, 0, 0)
 
local firstSequence = ColorSequence.new(firstColor)
local secondSequence = ColorSequence.new(secondColor)
 
trailEffect.Color = firstSequence
 
wait(1.5)
 
trailEffect.Color = secondSequence

Creating a Trail with a Color Gradient

This example creates a Trail with a gradient color. This means that the color at one end of the trail is different than the color at the opposite end of the trail, and both colors blend together as they get closer to the middle of the trail.

In order to create this effect, we must use a DataType/ColorSequence with two different colors. In our example, we use blue and red as the startColor and endColor.

The gif below shows what the output of this example should look like.

Texture color gradient using blue and red.

local trailEffect = script.Parent
  
local startColor = Color3.new(255, 0, 0)
local endColor = Color3.new(0, 0, 255)
  
local sequence = ColorSequence.new(startColor, endColor)
  
trailEffect.Color = sequence