Collapse Sidebar




The FaceCamera property determines whether the Trail is always drawn facing the camera. The default value is false.

If set to true, the trail textures will always face the camera. If set to false, the texture will be drawn in the direction of the distance between the trail’s Trail/Attachment0 and Trail/Attachment1.

Note that changing this property immediately affects all existing and future trail segments. This means that all existing and new segments will adjust to face the player’s camera or the direction of the attachments according to the property’s new state.

FaceCamera Enabled

Demonstrating a trail with the FaceCamera property set to true.

local trail = script.Parent
trail.FaceCamera = true

FaceCamera Disabled

Demonstrating a trail with the FaceCamera property set to false.

local trail = script.Parent
trail.FaceCamera = false

Code Samples

Setting a Trail’s FaceCamera Property

This example demos the functionality of the FaceEnabled property.

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 FaceCamera property to true. Then, every 5 seconds we toggle the property to the opposite state so that the property switches between true and false every few seconds. When the property is enabled (true), you can rotate your camera around the trail to demonstrate how the trail’s segments always face the player’s camera.

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.

-- Create a new BasePart
local part = Instance.new("Part")
part.Parent = game.Workspace
part.Anchored = true
part.Position = Vector3.new(0,5,0)

-- Create 2 attachments
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment0.Parent = part
attachment0.Position = Vector3.new(-2,0,0)

local attachment1 = Instance.new("Attachment")
attachment1.Name = "Attachment1"
attachment1.Parent = part
attachment1.Position = Vector3.new(2,0,0)

-- Create a new Trail
local trail = Instance.new("Trail")
trail.Parent = part
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
trail.FaceCamera = true

-- Tween part to display trail
local TweenService = game:GetService("TweenService")

local dir = 15
while true do
	dir = dir*-1

	trail.FaceCamera = not trail.FaceCamera

	local goal = {}
	goal.Position = part.Position + Vector3.new(0,0,dir)
	local tweenInfo = TweenInfo.new(5)
	local tween = TweenService:Create(part, tweenInfo, goal)