How do I make a part follow a set of nodes using CFrame?

Alright, your next agenda is executing the turning points, all you have to do is make the upcoming part that your vehicle is turning to matches the orientation of the vehicle (if that makes sense), but here I just added a line which is highlighted with a comment:

local systemPoints = {}

for i, v in pairs(pointsChildren) do
    table.insert(systemPoints,v)
end

wait(5)

for i = 1, #systemPoints do
    local Goal = {}
   Goal.Position = systemPoints[i].Position 
   Goal.Orientation = systemPoints[i].Orientation -- matches orientation just like position

    local tween = tweenService:Create(Part,tweenInfo,Goal)
    tween:Play()

    tween.Completed:Wait() 
end

Also, it would be cool to let me see how smooth it is now!

10 Likes

Wow! I thought I was going to have to do more work but I can’t believe one line just changes it all! I still have to work on building my turn radius and how the vehicle should turn but I’m liking this a lot!

3 Likes

I ended up figuring out the solution a while back but never touched this post :sweat_smile:
That’s pretty much how mine ended up turning out, here I am a few months later trying to synchronize the client’s version to the server and change the speed depending on the angle lol.

How exactly did you make it go to the next point? What I’m getting right now is the vehicle part going to random points within the folder.

You need to order the objects in the folder, maybe by naming it Spawn1, Spawn2 etc where Spawn1 will go first and so on.

or you can use attributes, creating an attribute called Spawn and assigning it to a value then when you insert it into the table SystemPoints you can control the order of what goes in first, second etc by their attributes.

I can show you a sample code if you’d like, but I doubt that you want that because of this late reply.

1 Like