-
What do you want to achieve?
I am trying to make it so bullets in my game have a trail behind them whenever it is fired. -
What is the issue?
The trail does not appear even though it is enabled & has the correct attachments selected.
Video of the bullet:
3. What solutions have you tried so far?
I have tried looking in the DevForum for answers and such however it has not helped at all. If anyone knows whats wrong, please tell me.
I am quite new to using trails and such so if anyone can help me I’d be ever grateful.
Code to make the bullet and trail:
local Attachment0 = Instance.new("Attachment")
Attachment0.Name = "Attachment0"
Attachment0.Visible = true
Attachment0.Parent = Player.Character.Head
Attachment0.Position = Player.Character.Head.Position
local Bullet = Instance.new("Part")
Bullet.Name = "Bullet"
Bullet.Parent = Player.Character
Bullet.Position = Player.Character.Head.Position
Bullet.CanCollide = false
Bullet.Anchored = true
Bullet.Shape = Enum.PartType.Ball
Bullet.Size = Vector3.new(0.3,0.3,0.3)
local Attachment1 = Instance.new("Attachment")
Attachment1.Name = "Attachment1"
Attachment1.Parent = Player.Character.Head
Attachment1.Visible = true
Attachment1.Position = Bullet.Position
local Trail = Instance.new("Trail")
Trail.Parent = Player.Character
Trail.LightEmission = 0
Trail.LightInfluence = 1
Trail.Enabled = true
Trail.Lifetime = 0.1
Trail.Attachment0 = Attachment0
Trail.Attachment1 = Attachment1
local Goal = {}
Goal.Position = position -- Ray Hit Position
local tweenInfo = TweenInfo.new(
0.1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
)
local Tween = TweenService:Create(Bullet,tweenInfo,Goal)
Tween:Play()