How should I seamlessly trail a projectile with parts?

I have a part moving 30 studs/second with body velocity and it want a seamless trail where no parts are overlapping each other.

How I instance the body velocity:

local part = workspace.Practice:Clone()
		part.Anchored = false
		part.CFrame = root.CFrame * CFrame.new(0, 3, -3)--CFrame.new((root.CFrame * CFrame.new(3, -2, 0)).Position,  root.CFrame.lookVector * 30 + root.CFrame.upVector)
		part.Parent = workspace
		
		local bv = Instance.new("BodyVelocity")
		bv.Velocity = root.CFrame.lookVector * 30 --+ root.CFrame.upVector
		bv.MaxForce = Vector3.new(1, 1, 1) * math.huge
		bv.Parent = part

The following code is how I’m making the trail:

while true do
  local trail = part:Clone()
  trail:ClearAllChildren()
  trail.Material = Enum.Material.ForceField
  trail.Name = "Trail"
  trail.Anchored = true
  trail.CFrame = part.CFrame
  trail.Parent = workspace
  wait(2/30)
end

What I currently have: https://gyazo.com/50216614f078d8068b94e6fe3a9ca0ae

What I would like to achieve: https://gyazo.com/260f53c1999d484861181a6e9c56018c

Also there are random jumps in the trail which I assume are from the lag so how do I account for that as well? I appreciate any and all help!

I’m sorry, I’m not sure how to do this.
I suggest you use a RunService.RenderStepped event instead of a while true do for a more seamless trail.

1 Like

Thanks for the response!

I tried doing a RunService.RenderStepped:Wait(), but the parts were overlapping each other and I still got the gaps. I decided to wait(2/30) because the size of each part is Vector3.new(2, 2, 2) and the speed is 30 studs/second.

Try this instead:

local sizeM = trail.Size.Magnitude -- the size would be Vector3.new(2, 2, 2)

wait(sizeM/30)

Lmk if there are any issues with the code

1 Like

Also, are you moving the trails on the server? If you are, I would advise moving the trails on the client instead as they seem to be faster and appear much smoother, you could use remote events to accomplish such tasks.

Thanks a lot!

It seems that wait(sizeM/2/30) made it the trail a lot more consistent(I’m not exactly sure why the extra division by 2 is needed but it worked out):

https://gyazo.com/32fa90d2541de75e569c27b0573076eb

However, there is still the problem of the random inconsistencies. Do you (or anyone else who might be reading) know of a way to adjust the wait time to consider frame rate?

Also to answer your question, yes I am creating and moving the trail on the client.