So currently I have a working Bezier Curve script but im a little confused on how to get the points to spread out evenly. I’ve read the article on DevHub but im a little confused. Can anyone help me understand?

Current error: https://gyazo.com/0a7c6d3e862e68004705b2c2a888e8bb

My script:

```
function lerp(p0, p1, t)
return (1 - t) * p0 + t * p1
end
local function quadratic(p0, p1, p2, t)
local L1 = lerp(p0, p1, t)
local L2 = lerp(p1, p2, t)
return lerp(L1, L2, t)
end
local function cubic(p0, p1, p2, p3, t)
local Q1 = quadratic(p0, p1, p2, t)
local Q2 = quadratic(p1, p2, p3, t)
return lerp(Q1, Q2, t)
end
function travelCurve(p0, p1, p2, p3, cart)
for t = 0, 1, 0.01 do
cart.Position = cubic(p0.Position, p1.Position, p2.Position, p3.Position, t)
cart.Orientation = cubic(p0.Orientation, p1.Orientation, p2.Orientation, p3.Orientation, t)
local newpart = Instance.new("Part")
newpart.Anchored = true
newpart.CanCollide = false
newpart.Material = "Neon"
newpart.BrickColor = BrickColor.White()
newpart.Position = cart.Position
newpart.Orientation = cart.Orientation
newpart.Size = Vector3.new(0.25, 0.25, 0.25)
newpart.Parent = workspace
wait()
end
end
travelCurve(workspace.p0, workspace.p1, workspace.p2, workspace.p3, workspace.cart)
```