Remake Trail with Parts

The big idea is to have a sword with a trail, but instead of a trail, its Parts. All I really need help with is the positioning, orientation, and size. I have a pretty start with that, but I’m not quite understanding CFrames.

				local old = hit.Position
				wait(smooth)
				local new = hit.Position
				local distance = math.sqrt((old.X - new.X)^2 + (old.Y - new.Y)^2 + (old.Z - new.Z)^2)
				lu = Instance.new("Part")
				lu.Anchored = true
				lu.Size = Vector3.new(5.27,.39,distance)
				lu.Position = old
				lu.CFrame = CFrame.new(old) * (lu.CFrame - hit.Position) * CFrame.new(distance/2, 0, 0)

-- hit is the "sword" if you will, it is the right value. And "smooth" is currently at .3, but that doesn't matter.

So that is what I have right now. If you know a way to give parts data from a trail in order to make them the same as the trail, then that would help tremendously. I also removed a lot of irrelevant stuff like transparency and the actual call function.

Some of you might say to read the “understanding CFrames” article, but I did, and it really just showed me how to do Everything except for this, so yeah lol.

edit-- I just thought of the curvature of the trail, I don’t need that.

2 Likes

I recently created a repo for someone that used the new BodyMovers in order to create parts that follow the player. You can modify this to have a main part follow the sword, and the other parts align their orientation and position with that main part. This saves you a lot of time dealing with CFrame calculations.

Here is the link to the example: