Smooth "ZigZag" lightning?

Hi I’m looking to create a smooth looking ZigZag effect; Ideally I want to travel from PointA to PointB smoothly & within an allocated time. Eg. 2 seconds, 1 second, 3 seconds and so forth.

I’m currently working with a rather “basic” layout and was wondering what I can do to allow for this change? Thank you!

https://gyazo.com/0c768240a4be7d395ef6bf3178b24b72

  local Model = script.Parent
  local Point1 = Model:WaitForChild("Point1")
  local Point2 = Model:WaitForChild("Point2")

  local BaseRay = Instance.new("Part")
  BaseRay.BrickColor = BrickColor.new("Toothpaste")
  BaseRay.Material = Enum.Material.Neon
  BaseRay.Size = Vector3.new(0.2, 0.2, 0.2)
  BaseRay.Anchored = true
  BaseRay.CanCollide = false
  BaseRayMesh = Instance.new("SpecialMesh")
  BaseRayMesh.Name = "Mesh"
  BaseRayMesh.MeshType = Enum.MeshType.Brick
  BaseRayMesh.Scale = Vector3.new(0.2, 0.2, 1)
  BaseRayMesh.Offset = Vector3.new(0, 0, 0)
  BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
  BaseRayMesh.Parent = BaseRay
  
  function CreateRay(StartPoint, EndPoint)
    local Vec = (EndPoint - StartPoint)
    local Distance = Vec.magnitude
    local Direction = Vec.unit

    local PX = (StartPoint + (0.25 * Distance) * Direction)
    local PY = (StartPoint + (0.5 * Distance) * Direction)
    local PZ = (StartPoint + (0.75 * Distance) * Direction)

    local DX = (StartPoint - PX).magnitude
    local DY = (PX - PY).magnitude
    local DZ = (PY - PZ).magnitude

    local Limit = 2
    local AX = (PX + Vector3.new(math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX))),math.random(math.max(-Limit, (-0.21 * DX)),math.min(Limit, (0.21 * DX))), math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX)))))
    local AY = (PY + Vector3.new(math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY))),math.random(math.max(-Limit, (-0.21 * DY)),math.min(Limit, (0.21 * DY))), math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY)))))
    local AZ = (PZ + Vector3.new(math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ))),math.random(math.max(-Limit, (-0.21 * DZ)),math.min(Limit, (0.21 * DZ))), math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ)))))

    local Rays = {
      {Distance = (AX - StartPoint).magnitude, Direction = CFrame.new(StartPoint, AX)},
      {Distance = (AY - AX).magnitude, Direction = CFrame.new(AX, AY)},
      {Distance = (AZ - AY).magnitude, Direction = CFrame.new(AY, AZ)},
      {Distance = (EndPoint - AZ).magnitude, Direction = CFrame.new(AZ, EndPoint)},
    }

    local th = 0.1
    local Table = {}

    for i, v in pairs(Rays) do
      task.wait(0.01)

      local Ray = BaseRay:Clone()
      Ray.BrickColor = BrickColor.new("Bright red")
      Ray.Transparency = 0.7

      table.insert(Table, Ray)

      local Mesh = Ray.Mesh
      Mesh.Scale = (Vector3.new(th, th, (v.Distance / 1)) * 5)
      Ray.CFrame = (v.Direction * CFrame.new(0, 0, (-0.5 * v.Distance)))

      task.spawn(function()
        task.wait(i / 25)
        Table[i]:Destroy()
      end)
      Ray.Parent = workspace
    end
  end
  
  while true do wait()
    CreateRay(Point1.Position, Point2.Position)
  end

Try beams, Use Beam.CurveSize0 and Beam.CurveSize1 to create that effect.