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

LightInfluence

Trail

float

LightInfluence determines the factor the light in the environment affects the appearance of the Trail. A value of zero (0) ensures no influence which allows a trail to be visible even in complete darkness.

Changing this property immediately affects all existing and future segments of the trail.

See also

  • Trail/LightEmission|LightEmission, another Trail property related to light
  • Beam/LightEmission, an identical property used by Beams


Code Samples


Setting a Trail's Light Influence

This example demos the trail’s light influence property.

In order to do this, we must first set Lighting’s Lighting/Brightness to 0. This is done to create a better demo lighting to demo the differences in the trail’s appearance when the light influence property changes.

Next, we 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 initially set the LightInfluence property to 1. Then, every 5 seconds we increment the property so that it toggles between 0 and 1. When the value is 0, the trail appears much brighter because it is not influenced by Lighting’s low brightness as compared to when the value is 1.

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