How to a electric arc

So I have made a lightning script which basically makes a straight path between 2 points and segments it and gives the segments offset;
what I want to do is make this straight path curved

This Is what I have made so far-

local module = {}

module.Lit = function(startpos,endpos,segments)
	local points = {}
	local model = Instance.new("Model")
	model.Parent = workspace
	model.Name = "Modal da debris"
	for i=0,segments do
local offset
--important part
				local position  = startpos + (endpos - startpos).Unit *i* (endpos -startpos).Magnitude/segments 
--offset thingie
				if i == 0 or i == segments then
	           offset = Vector3.new(0,0,0)
		      else
			offset = Vector3.new( math.random(-2,-2),math.random(-2,2),math.random(-2,2)   )
		     end
		local i2
		if i ==0 then
			i2 = 1
		else 
		i2 = i
		end
points[i2] = position + offset
local lightning = script.Part:Clone()
lightning.Position = position + offset
lightning.Parent = model
lightning.Name = "seg"..tostring(i)		
	end	

	--you can ignore this until and unless u wanna know how i connect the segments with the beams
	for i =1, #points do
		if points[i]  ~= nil then
			local beam = script.Beam:Clone()
			local attach = Instance.new("Attachment")
			attach.Parent = model["seg"..tostring(i-1)]

			local attach1 = Instance.new("Attachment")
			attach1.Parent = model["seg"..tostring(i)]		

			beam.Attachment0 = attach
			beam.Attachment1 = attach1
            beam.Parent = model
		end
	end
	return model
end
return module

I am just trying to make a curved path with a given radius and center and maybe 2 endpoints

its been a long day without any replies (bla bla bla)
either way if you know any module scripts that maybe able to help somehow please let me know
also I saw this plugin called bezier Path wonder if i could use it maybe

This article may help. https://developer.roblox.com/en-us/articles/Bezier-curves

Also try using the Search bar up top, there are a few posts about ‘lightning effects’, here’s one:

that post has the same output as i have but im trying to make it curved

Sorry, I’m on my phone and don’t have time to run through your script, but I made a lightning tutorial a couple years ago that has jagged and random path from point A - B

It is old so apologies for the poor quality.

my lightning script is working what I am trying to do rn is like make a curved path and segment that