PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

Transparency

Trail

NumberSequence

The Transparency property of a Trail sets how transparent the segments of the trail are over the trail’s Trail/Lifetime. This value is a DataType/NumberSequence, meaning it can be a static value or can change throughout the lifetime of the trail segments.

The values in the NumberSequence can be any number, but the effective range of transparency is 0 (completely opaque) to 1 (completely see-through). The Transparency property for TrailEffects defaults to 0.5.


Code Samples


Playing in Third Person

This example demonstrates how to change the character’s CameraMode to third person using the Classic value of the Enum/CameraMode enum.


Setting a Trail's Transparency: Single Value Sequence

This example demos setting the transparency of a trail using a single value sequence DataType/NumberSequence.

In order to do this, we must first create a BasePart, part, which will be the parent of the trail.

Then, we create two attachments, attachment0 and attachment1, both parented to part. The positions of these two attachments, more importantly the distance between them, determines where the trail is drawn as part moves.

For these attachments to create a trail as described, we create a new Trail and parent it to part. We then connect attachment0 to Trail/Attachment0 and attachment1 to Trail/Attachment1.

In this example, we set the trail’s transparency to 0.8 using a single value sequence, which means that the transparency of the drawn segments is linear and constant.

Finally, to demo the transparency the example relies on TweenService’s TweenService/Create to move part back and forth. As the part moves, the trail is drawn.

Demonstrating the single value sequence trail transparency.


Setting a Trail's Transparency: Multi Value Sequence

This example demos setting the transparency of a trail using a multi value sequence DataType/NumberSequence.

In order to do this, we must first create a BasePart, part, which will be the parent of the trail.

Then, we create two attachments, attachment0 and attachment1, both parented to part. The positions of these two attachments, more importantly the distance between them, determines where the trail is drawn as part moves.

For these attachments to create a trail as described, we create a new Trail and parent it to part. We then connect attachment0 to Trail/Attachment0 and attachment1 to Trail/Attachment1.

In this example, we set the trail’s transparency to a multi value gradient using a multi value sequence. This means that the transparency of the drawn segments is a gradient consisting of a variety of transparencies, each equally spaced out along the trail’s existing segments according to the order of the transparency value in the keypoints array.

Finally, to demo the transparency the example relies on TweenService’s TweenService/Create to move part back and forth. As the part moves, the trail is drawn.

Demonstrating the multiple value sequence trail transparency.