Get distance along spline from world location

I was part way into trying to implement an expandable checkpoint and distance comparison thing to do this, I knew there had to be a better way but couldn’t see how to get the right info off the spline to get it to work. that example is so much simpler and think solves all the headache, cheers for posting it