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

TextureLength

Trail

float

This property determines how Trail/Textures are drawn by Trail. The behavior of TextureLength is determined by the Trail/TextureMode of its trail.

If the TextureLength is changed after its trail has drawn some of its segments, the new length will only be applied to new segments being drawn – old segments will be unaffected.

This value can be any number greater than 0 and defaults to 1.


Code Samples


Setting a Trail's Texture Length

This example demos setting a trail’s texture length.

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 initially set the trail’s texture length to 4 (and Trail/TextureMode to static). Then, to demonstrate the effects of changing the trail length, we alternate between a trail length of 2 and 4 every 5 seconds by adding and subtracting 2 from the length. This example uses the pawprint image as its Trail/Texture.

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

Demonstrating the static trail texture mode.