My attack isn't curving properly on different axes

  1. I want my ability to curve properly, however, if I go onto a different axes it doesn’t line up properly. [https://gyazo.com/22ef9a13c6148683d559fd94eded66a8], this is a example of it working how I want it to be. I also want the parts to line up together, so not just relative to my humanoidrootpart, so if I were to run fast the separate parts wouldn’t separate from each other they would still stay equal distance from their preceding parts.

  2. The issue is that when I angle myself differently it will invert and not properly follow me. [https://gyazo.com/39f32bc0f50fb3cda69931f4c78f6c27] like this.

  3. I tried many different ways of writing this, I’m sure that I’m making this more complicated than it actually is but I just can’t get the right math down.

I could provide more videos/examples if needed those are just the two gifs I have right now. I apologize if my format is off this is my first time making a post. The “root” in this script is HumanoidRootPart, and the Fire Trail is the Fire Part’s I’m cloning.

local offset = 7
local prev

for i = 1, 8 do

if i == 1 then
local part = game.ServerStorage.ElementParts.Fire["Fire Trail"]:Clone()
part.Parent = game.Workspace
part.CFrame = root.CFrame * CFrame.new(0,0,-10)     
prev = part
game.Debris:AddItem(part, 14)
else

local part = game.ServerStorage.ElementParts.Fire["Fire Trail"]:Clone()
part.Parent = game.Workspace
part.CFrame = prev.CFrame  * CFrame.new(root.CFrame.LookVector.x * offset, 0, root.CFrame.LookVector.z * offset)
print(root.CFrame.LookVector)
prev = part
game.Debris:AddItem(part, 14)
end

wait(0.1)
end

prev = nil

Any help is greatly appreciated! Thank you.

i believe that since you are constantly updating the prev cframe while trying to get the angle it messes up the parts cframe

im not sure if this is the thing you are looking for but heres my solution

local offset = 7
local prev
for i = 1, 8 do
	if i == 1 then
		local part = game.ServerStorage.ElementParts.Fire["Fire Trail"]:Clone()
		part.Parent = game.Workspace
		part.CFrame = root.CFrame * CFrame.new(0,0,-10)
		prev = part
		game.Debris:AddItem(part, 14)
	else		
		local part = game.ServerStorage.ElementParts.Fire["Fire Trail"]:Clone()
		part.Parent = game.Workspace
		local pos = prev.CFrame * CFrame.new(0,0,-offset).p;
		local angle = root.CFrame - root.Position;
		part.CFrame = angle + pos;
		prev = part
		game.Debris:AddItem(part, 14)
	end	
	wait(0.1)
end
prev = nil
2 Likes

Omg thank you so much, that was it! I really appreciate the help I struggled with it for awhile.