How to i fix this rotation problem

Okay so this is quite a complicated question so ima put in my code first

function rotateCFrame(x, z, theta) --rotate a point around 0,0
	local xP = x * math.cos(math.rad(theta)) - z * math.sin(math.rad(theta))
	local zP = z * math.cos(math.rad(theta)) + x * math.sin(math.rad(theta))
	return(CFrame.new(xP,0,zP))
end

function getCFramesFromArc(r, arcDegree, amount, isHorizontal) --create points around an arc
	local tAmount = amount-1
	local CFrameList = {}
	for theta = 0, arcDegree, arcDegree/tAmount do
		local x = r * math.cos(math.rad(theta))
		local z = r * math.sin(math.rad(theta))
		if isHorizontal then
			table.insert(CFrameList, CFrame.new(x,0,z))
		else
			table.insert(CFrameList, CFrame.new(z,x,0))
		end
	end
	return(CFrameList)
	
endfunctionDict.RisingFlame.skillFunction = function(plr) --ignore how the function is activated, i have my ways
	for i = 1,12,1 do --create 12 different rotations
		local RisingCFrameList = getCFramesFromArc(5, 180, 36, false) --get vertical arc
		for k,l in pairs(RisingCFrameList) do 
			local flameParticle = game.ReplicatedStorage.SkillModels.FlameParticle:Clone() -- clone the particles toward the vertical arc
			local rotation = rotateCFrame(l.X, l.Z, i*30) -- rotate the particle
			flameParticle.Parent = workspace 
			flameParticle.CFrame = plr.Character.HumanoidRootPart.CFrame * l * rotation --apply the transformation
		end
		wait(0.2)
	end
	
end

Okay so here is the problem

instead of looking sth like this
image

It look like this
image

This is quite complicated but i still want to know how do i fix it?

2 Likes