Problem when doing Barrage in Arc using Bézier

Hello, I found this code for making a barrage in arc effect using Bézier curves:

local function TweenArm(Arm,pivotCFrame)
			local ArmStartCf = Arm.CFrame
			local TimePassed = 0

			local rnd =
			local rndCF =,4),rnd:NextNumber(-5,5),rnd:NextNumber(-4,4))

			local Speed = 2
			local Duration = (ArmStartCf.p - pivotCFrame.Position).Magnitude / Speed
			local tweenDelay = 0.1
			TimePassed = 0
			while TimePassed < Duration do
				local TimeRunning = TimePassed / Duration
				local MiddlePoint = (ArmStartCf * rndCF).p
				local pointAtTimePassed = Bezier_Module:QuadraticBezier(TimeRunning,ArmStartCf.p,MiddlePoint, pivotCFrame.p)
				local lookAt = Bezier_Module:QuadraticBezier(TimeRunning+0.01,ArmStartCf.p,MiddlePoint, pivotCFrame.p)
				if TimePassed == 0 then
					Arm.CFrame =,Bezier_Module:QuadraticBezier(TimeRunning+.01,ArmStartCf.p,(ArmStartCf * rndCF).p, pivotCFrame.p))
				elseif TimePassed == Speed then
					local tween = TweenS:Create(Arm,,{Transparency = 0}):Play()
				TimePassed += Speed
				local tween = TweenS:Create(Arm,,{CFrame =,lookAt)})

My problem is, it doesn’t look as I expected it to, the arms are supposed to move horizontally like this:

Instead it ends moving this way, and I don’t know how to fix that.

I’ve tried a loop setting the orientation and the CFrame.Angles, but Orientation doesn’t give a good result and CFrame.Angles doesn’t work.

The Blocks are just a clone of the stand arms:

		local LeftArm = Stand:WaitForChild("Left Arm"):Clone()
		LeftArm.CanCollide = false
		LeftArm.Anchored = true
		LeftArm.Parent = BarrageEffectsFolder
		LeftArm.Transparency = 1

		local RightArm = Stand:WaitForChild("Right Arm"):Clone()
		RightArm.CanCollide = false
		RightArm.Anchored = true
		RightArm.Parent = BarrageEffectsFolder
		RightArm.Transparency = 1

How could I fix this issue?

1 Like

I’d guess it’s because the direction of the length of the arm isn’t the Z axis as it should have been, but the Y axis. Change the target CFrame to

{CFrame =,lookAt) * CFrame.angles(0, 0, math.deg(90)}

… or some other variation, I’m not sure which axis you need to rotate on to get it right. Just try rotating on different axes, or in the opposite direction (-90 instead of 90).


Can you drop modules? i want to learn bezier with arm skill