Implementing Bezier Curves into my barraging

I am trying to implement Bezier Curves into my Barrage to make the flow of the arms more fluid while striking, I have looked at the following resources

and still cannot figure out how it works and am completely lost in the dirt

this is the handler for the barraging the handles the tweening

local rp = game:GetService("ReplicatedStorage")
local Barrage = rp:WaitForChild("Barrage")

local TweenService = game:GetService("TweenService")

local Animations = script:WaitForChild("Animations")

local SSS = game:GetService("ServerScriptService")
local Library = SSS:WaitForChild("Library")
local DictionaryHandler = require(Library:WaitForChild("DictonaryHandler"))

local Barrage_Handler = require(script.Barrage_Handler)
local Bezier_Module = game.Workspace.Bezier

local maxDuartion = 5
Barrage.OnServerEvent:Connect(function(Player,isActive)
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	local HumanoidRP = Character.HumanoidRootPart

	if not DictionaryHandler.findPlayer(Humanoid,"Stunned") and not DictionaryHandler.findPlayer(Humanoid,"Blocking") and not DictionaryHandler.findPlayer(Humanoid,"Punching") then

		if isActive then
			local Stand = Character:FindFirstChild("Stand")
			if Stand then

				local AnimControl = Stand:FindFirstChild("AnimControl")
				if AnimControl then

					local Controller = Stand.PrimaryPart:FindFirstChild("Controller")
					if Controller then
						local Folder = Instance.new("Folder",Character)
						Folder.Name = "Effects"

						Humanoid.WalkSpeed = 4
						Humanoid.JumpPower = 0 

						local goal = {}
						goal.C0 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame)
						goal.C1 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame * CFrame.new(0,.25,-2))
						local info = TweenInfo.new(.1)
						local Tween = TweenService:Create(Controller,info,goal)
						Tween:Play()

						Tween.Completed:Connect(function()
							Tween:Destroy()

							local punching = AnimControl:LoadAnimation(Animations.Barrage)
							punching:Play()
							DictionaryHandler.addTo(Humanoid,"Barraging")
							Barrage_Handler.punches(Character,Stand,Folder)
						end)

						spawn(function()
							wait(maxDuartion)

							local Folder = Character:FindFirstChild("Effects")
							if Folder then
								Humanoid.WalkSpeed = 16 
								Humanoid.JumpPower = 50 

								local goal = {}
								goal.C0 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame)
								goal.C1 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame * CFrame.new(-3,1,2))
								local info = TweenInfo.new(.1)
								local Tween = TweenService:Create(Controller,info,goal)
								Tween:Play()

								for _, track in pairs(AnimControl:GetPlayingAnimationTracks()) do
									if track.Name == "Barrage" then
										track:Stop()
										DictionaryHandler.removeFrom(Humanoid,"Barraging")
									end
								end

								Barrage_Handler.cleanUp(Folder)
							end
						end)

					end
				end
			else 
				Barrage:FireClient(Player)
			end
		else
			local Stand = Character:FindFirstChild("Stand")
			if Stand then

				local AnimControl = Stand:FindFirstChild("AnimControl")
				if AnimControl then

					local Controller = Stand.PrimaryPart:FindFirstChild("Controller")
					if Controller then
						local Folder = Character:FindFirstChild("Effects")
						if Folder then
							Humanoid.WalkSpeed = 16 
							Humanoid.JumpPower = 50 

							local goal = {}
							goal.C0 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame)
							goal.C1 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame * CFrame.new(-3,1,2))
							local info = TweenInfo.new(.1)
							local Tween = TweenService:Create(Controller,info,goal)
							Tween:Play()

							for _, track in pairs(AnimControl:GetPlayingAnimationTracks()) do
								if track.Name == "Barrage" then
									track:Stop()
									DictionaryHandler.removeFrom(Humanoid,"Barraging")
								end
							end

							Barrage_Handler.cleanUp(Folder)
						end
					end
				end
			end
			Barrage:FireClient(Player)
		end

	else
		Barrage:FireClient(Player)
	end
end)

and this is all it does is move the arms in a straight motion instead of the wanted curve.
Can anyone help explain this in a simple way that I can understand?

not gonna explain it but i will send the proper script, here you go.

function lerp(a, b, c)
	return a + (b - a) * c
end

function quadBezier(t, p0, p1, p2)
	local l1 = lerp(p0, p1, t)
	local l2 = lerp(p1, p2, t)
	local quad = lerp(l1, l2, t)
	return quad
end

game.ReplicatedStorage.Barrage.OnServerEvent:Connect(function(p,dmg)
	local Character = p.Character
	local Humanoid = Character.Humanoid
	local Stand = Character.Stand
	
	spawn(function()
		local part
		local leftOrRight = math.random(1,2)
		local p0 = Stand.StandHumanoidRootPart.Position
		local p1
		if leftOrRight == 1 then
			-- right
			part = Stand["Stand Right Arm"]:Clone()
			p1 = Stand.StandHumanoidRootPart.Right.WorldPosition + Vector3.new(0,math.random(-2,2),0)
		end
		for i,v in pairs(part:GetDescendants()) do
			if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
				game.TweenService:Create(v,TweenInfo.new(1),{Transparency = 0}):Play()
			end
		end
		part.Parent = workspace
		part.CanCollide = false
		part.Anchored = true
		local p2 = Stand.StandHumanoidRootPart.End.WorldPosition
		local tweendelay = wait()
		game.Debris:AddItem(part,1)
		game.TweenService:Create(part,TweenInfo.new(1),{Transparency = 1}):Play()
		for i = 1, 10 do
			local t = i/10
			local Pos = quadBezier(t, p0, p1, p2)
			local Direction = quadBezier(t + 0.015, p0, p1, p2)
			--part.CFrame = CFrame.new(Pos, Direction)
			game.TweenService:Create(part,TweenInfo.new(tweendelay),{CFrame = CFrame.new(Pos, Direction) * CFrame.Angles(math.rad(90),0,0)}):Play()
			wait()
		end
	end)
end)
		game.ReplicatedStorage.Barrage.OnServerEvent:Connect(function(p,dmg)
			local Character = p.Character
			local Humanoid = Character.Humanoid
			local Stand = Character.Stand

			spawn(function()
				local part
				local leftOrRight = math.random(1,2)
				local p0 = Stand.StandHumanoidRootPart.Position
				local p1
				if leftOrRight == 1 then
					-- left
					part = Stand["Stand Left Arm"]:Clone()
					p1 = Stand.StandHumanoidRootPart.Left.WorldPosition + Vector3.new(0,math.random(-2,2),0)
				end
				for i,v in pairs(part:GetDescendants()) do
					if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
						game.TweenService:Create(v,TweenInfo.new(1),{Transparency = 0}):Play()
					end
				end
				part.Parent = workspace
				part.CanCollide = false
				part.Anchored = true
				local p2 = Stand.StandHumanoidRootPart.End2.WorldPosition
				local tweendelay = wait()
				game.Debris:AddItem(part,1)
				game.TweenService:Create(part,TweenInfo.new(1),{Transparency = 1}):Play()
				for i = 1, 10 do
					local t = i/10
					local Pos = quadBezier(t, p0, p1, p2)
			local Direction = quadBezier(t + 0.015, p0, p1, p2)
					--part.CFrame = CFrame.new(Pos, Direction)
					game.TweenService:Create(part,TweenInfo.new(tweendelay),{CFrame = CFrame.new(Pos, Direction) * CFrame.Angles(math.rad(90),0,0)}):Play()
			        wait()
		 end
	end)
end)

game.ReplicatedStorage.Barrage.OnServerEvent:Connect(function(p,dmg)
	local Character = p.Character
	local Humanoid = Character.Humanoid
	local Stand = Character.Stand

	spawn(function()
		local part
		local leftOrRight = math.random(1,2)
		local p0 = Stand.StandHumanoidRootPart.Position
		local p1
		if leftOrRight == 1 then
			-- right
			part = Stand["Stand Right Arm"]:Clone()
			p1 = Stand.StandHumanoidRootPart.Right2.WorldPosition + Vector3.new(0,math.random(-2,2),0)
		end
		for i,v in pairs(part:GetDescendants()) do
			if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
				game.TweenService:Create(v,TweenInfo.new(1),{Transparency = 0}):Play()
			end
		end
		part.Parent = workspace
		part.CanCollide = false
		part.Anchored = true
		local p2 = Stand.StandHumanoidRootPart.End.WorldPosition
		local tweendelay = wait()
		game.Debris:AddItem(part,1)
		game.TweenService:Create(part,TweenInfo.new(1),{Transparency = 1}):Play()
		for i = 1, 10 do
			local t = i/10
			local Pos = quadBezier(t, p0, p1, p2)
			local Direction = quadBezier(t + 0.015, p0, p1, p2)
			--part.CFrame = CFrame.new(Pos, Direction)
			game.TweenService:Create(part,TweenInfo.new(tweendelay),{CFrame = CFrame.new(Pos, Direction) * CFrame.Angles(math.rad(90),0,0)}):Play()
			wait()
		end
	end)
end)
game.ReplicatedStorage.Barrage.OnServerEvent:Connect(function(p,dmg)
	local Character = p.Character
	local Humanoid = Character.Humanoid
	local Stand = Character.Stand

	spawn(function()
		local part
		local leftOrRight = math.random(1,2)
		local p0 = Stand.StandHumanoidRootPart.Position
		local p1
		if leftOrRight == 1 then
			-- left
			part = Stand["Stand Left Arm"]:Clone()
			p1 = Stand.StandHumanoidRootPart.Left2.WorldPosition + Vector3.new(0,math.random(-2,2),0)
		end
		for i,v in pairs(part:GetDescendants()) do
			if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
				game.TweenService:Create(v,TweenInfo.new(1),{Transparency = 0}):Play()
			end
		end
		part.Parent = workspace
		part.CanCollide = false
		part.Anchored = true
		local p2 = Stand.StandHumanoidRootPart.End2.WorldPosition
		local tweendelay = wait()
		game.Debris:AddItem(part,1)
		game.TweenService:Create(part,TweenInfo.new(1),{Transparency = 1}):Play()
		for i = 1, 10 do
			local t = i/10
			local Pos = quadBezier(t, p0, p1, p2)
			local Direction = quadBezier(t + 0.015, p0, p1, p2)
			--part.CFrame = CFrame.new(Pos, Direction)
			game.TweenService:Create(part,TweenInfo.new(tweendelay),{CFrame = CFrame.new(Pos, Direction) * CFrame.Angles(math.rad(90),0,0)}):Play()
			wait()
		end
	end)
end)

And put this inside the stand model

local p = game.Players.LocalPlayer
local c = p.Character
local h = c:WaitForChild("Humanoid")
local stand = c.Stand
local hrp = c.HumanoidRootPart
local shrp = stand.StandHumanoidRootPart
local uis = game:GetService("UserInputService")
local lmbCount = 0

local Idle = h:LoadAnimation(game.ReplicatedStorage.Animations.TWIDLE)
local Chop = h:LoadAnimation(game.ReplicatedStorage.Animations.TWMUDA)
local Barrage = h:LoadAnimation(game.ReplicatedStorage.Animations.TWBarrage)
local lmb1 = h:LoadAnimation(game.ReplicatedStorage.Animations.TWLMB1)
local lmb2 = h:LoadAnimation(game.ReplicatedStorage.Animations.TWLMB2)
local knifeThrow = h:LoadAnimation(game.ReplicatedStorage.Animations.KnifeThrow)

-- CameraShaker

local Camera = workspace.Camera
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage.Remotes
local CameraFolder = game.ReplicatedStorage.Remotes.Camera
local CameraShaker = require(game.ReplicatedStorage:WaitForChild("CameraShaker"))

local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
	Camera.CFrame = Camera.CFrame * shakeCf
end)

camShake:Start()


--



-- Events

local damage = game.ReplicatedStorage.Damage
local barrageEffect = game.ReplicatedStorage.Barrage

--

local ChopCooldown = false
local BarrageCooldown = false
local lmbCD = false
local KnifeCoolDown = false

local beep = false
local active = false
local appeared = false

uis.InputBegan:Connect(function(k,chat)
	if active == true then return end
	if chat then return end
	if k.KeyCode == Enum.KeyCode.Q then
		if appeared == false then
			appeared = true
			Idle:Play(0)
			for i,v in pairs(stand:GetDescendants()) do
				if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
					if v.Name ~= "StandHumanoidRootPart" and v.Parent.Name ~= "KnifeModel" then
						game.ReplicatedStorage.Transparency:FireServer(v,.4,0)
					end
				end
			end
		else
			Idle:Stop()
			appeared = false
			for i,v in pairs(stand:GetDescendants()) do
				if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
					game.ReplicatedStorage.Transparency:FireServer(v,.4,1)
				end
			end
		end
	elseif k.KeyCode == Enum.KeyCode.E and BarrageCooldown == false and appeared == true then
		local HM = 0
		active = true
		Barrage:Play(.1,1,2)
		camShake:Shake(CameraShaker.Presets.RoughDriving)
		h.WalkSpeed = 5
		beep = true
		repeat
			HM += 1
			barrageEffect:FireServer(1)
			damage:FireServer(stand:FindFirstChild("Stand Right Arm"),.3,shrp.PunchHit2)
			damage:FireServer(stand:FindFirstChild("Stand Left Arm"),.3,shrp.PunchHit2)
			wait(.1)
		until HM == 60 or beep == false
		active = false
		Barrage:Stop(.1,1,1)
		h.WalkSpeed = 16
	elseif k.KeyCode == Enum.KeyCode.R and ChopCooldown == false and appeared == true then
		ChopCooldown = true
		active = true
		shrp.Chop:Play()
		camShake:Shake(CameraShaker.Presets.RoughDriving)
		h.WalkSpeed = 5
		Chop:Play(.1,1,1)
		wait(.1)
		damage:FireServer(stand:FindFirstChild("Stand Right Arm"),10,shrp.PunchHit1)
		Chop.Stopped:Wait()
		h.WalkSpeed = 16
		active = false
		wait(1)
		ChopCooldown = false
	elseif k.UserInputType == Enum.UserInputType.MouseButton1 and appeared == true and lmbCD == false then
		lmbCount += 1
		active = true
		lmbCD = true
		if lmbCount == 1 then
			lmb1:Play(.1,1,1)
			camShake:Shake(CameraShaker.Presets.RoughDriving)
			wait(.15)
			damage:FireServer(stand:FindFirstChild("Stand Right Arm"),5,shrp.PunchHit2)
			wait(.1)
			active = false
			wait(.5)
			lmbCD = false
		elseif lmbCount ==2 then
			lmb2:Play(.1,1,1)
			camShake:Shake(CameraShaker.Presets.RoughDriving)
			wait(.15)
			damage:FireServer(stand:FindFirstChild("Stand Left Arm"),5,shrp.PunchHit2)
			wait(.1)
			active = false
			lmbCount = 0
			wait(.5)
			lmbCD = false
		end

	elseif k.KeyCode == Enum.KeyCode.T and KnifeCoolDown == false then
		knifeThrow:Play()
		camShake:Shake(CameraShaker.Presets.RoughDriving)
		h.WalkSpeed = 5
		KnifeCoolDown = true
		active = true
		wait(.35)
		game.ReplicatedStorage.Knife:FireServer(30--[[ Damage ]], 100--[[ Velocity ]])
		knifeThrow.Stopped:Wait()
		h.WalkSpeed = 15
		active = false
		wait(3)
		KnifeCoolDown = false
		
	end
end)

uis.InputEnded:Connect(function(k,chat)
	if chat then return end
	if k.KeyCode == Enum.KeyCode.E then
		beep = false
	end
end)

Or if you dont wanna overwrite just get the parts that will support it.
ended up like this for me
https://gyazo.com/603b6986e942742f59c6f19cedcea414

1 Like