So I want to make a part move until a certain point, how do I do that? I don't know how/what functions/code I should use because I have only been scripting for 2 weeks, but I am pretty experienced.
COMMUNITY QUESTION
How do you use CFrame with in pairs loop?
1 answer
You don't need a generic for loop, just a regular one.
pointA = workspace.Part1.Position
pointB = workspace.Part2.Position
for i = 0, 1, .01 do --Change the .01 to your own increment if you wish
local newPoint = pointA:Lerp(pointB, i)
workspace.Part1.CFrame = CFrame.new(newPoint)
wait(.05) --Change the wait to your own, too
end
workspace.Part1.CFrame = workspace.Part2.CFrame --Just making sure it ends up in the right spot
This should work between any two points. It relies on the :Lerp() function. It basically finds a point in between two other points given the two points and an alpha. For more check this out.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Why would you use a
pairsloop to do this?Also, don't say you are "pretty experienced" if you have been writing code for 2 weeks. I've been writing code for around 9 years and I still run into problems. Saying that, especially when it's not true, isn't helpful.
^, Hes attempting to make a Tablet Admin or some sort of Walking pet..