I've written some maxscript that clones selected splines within an editable spline.
It works fine on its own but when I make it into a function it stops working 
I'm a bit new to maxscript and I'm probably doing something stupid
can anybody help please.
thanks.
Code:
SelectedSplines = getsplineselection $ TotalSplines = SelectedSplines.count for CurrentSpline = 1 to TotalSplines do ( addNewSpline $ NewSplineIndex = numSplines $ SplineIndex = SelectedSplines [CurrentSpline] for KnotIndex = 1 to (numknots $ SplineIndex) do ( VertexPos = getKnotPoint $ SplineIndex KnotIndex addKnot $ NewSplineIndex #corner #line VertexPos ) Close $ NewSplineIndex updateshape $ )

Code:
fn CloneSplines = ( SelectedSplines = getsplineselection $ TotalSplines = SelectedSplines.count for CurrentSpline = 1 to TotalSplines do ( addNewSpline $ NewSplineIndex = numSplines $ SplineIndex = SelectedSplines [CurrentSpline] for KnotIndex = 1 to (numknots $ SplineIndex) do ( VertexPos = getKnotPoint $ SplineIndex KnotIndex addKnot $ NewSplineIndex #corner #line VertexPos ) Close $ NewSplineIndex updateshape $ ) ) CloneSplines

thanks.
Comment