Track-system that smoothly follows a laid out track?

Hello,

I’ve been trying to making a system that follows a route I marked out by parts; however, after trying 4 months some stuff, I never came to a success.

This is what I wanted:
Lay out a track in parts, each parts named ‘Track#’ and # would be the corresponding number, so 1, 2, etc.

Is there anyone who has or knows an open-source system that uses this or something familiar?

Thanks!

PS: Enjoy this picture, because it’s Monday.

  • Omg cute dog
  • I don’t like dogs

0 voters

I don’t know exactly how you personally go about moving one part to another, so Ill simply show you how to take any arbitrary number of parts named “Track#” and sort it into a table by the number.

local TrackPoints = workspace.TrackPoints:GetChildren() -- Get all Current Track Points

local function SortByName(a,b)
    return tonumber(string.match(a.Name , "%d+")) > tonumber(string.match(b.Name , "%d+"))
end

table.sort(TrackPoints, SortByName)

You can now iterate through TrackPoints (using ipairs or something similar) and guarantee your track points are sorted by the numbers at the end of their names.

You could always use another object that has a part0, part1, so that you always know where the next target is. I use beams, since they are visually represented on screen.