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

MinLength

Trail

float

The MinLength of a Trail determines the minimum length of each of the segments in the trail.

If neither of the trail’s Trail/Attachment0 or Trail/Attachment1 have moved at least the minimum length in studs, then no new segments will be created and the endpoints of the current segment will be moved to the current position of the attachments.

Note that changing MinLength will only affect new segments that are drawn – any old segments that have already been drawn will maintain their current length.

This value can be any number greater than or equal to 0, and defaults to 0.1.

This property can also be used alongside the Trail/MaxLength property, which determines the maximum length trail may be before its oldest segments are erased.

Minimum length of a trail's segment in studs.


Code Samples


Setting a Trail's Minimum Length

This example alternates between setting a trail’s minimum length of a trail to 10 studs and 0.1 studs every 3 seconds.

To best display the change in minimum trail length, we first set the Trail/Lifetime of the trail to 4. This means that the trail drawn will disappear 4 seconds after it is drawn.

In order for this example to work as expected, the script containing this code must be a child of the trail. If you would like to place the code in a script that is not the child of the trail, you must change the trail value to point to the location of the trail object in the game.

local trail = script.Parent
 
trail.Lifetime = 4
 
while wait(3) do
    trail.MinLength = 10
    wait(3)
    trail.MinLength = 0.1
end