If I'm understanding your problem correctly, it seems to me that you just want to lengthen the iterations of your for loop. The second argument of lerp is simply just the progression from point A to point B (A being 0, B being 1), so just change the step of each iteration.
local platechosen = script.Parent.Parent.Part
local targetBrick = game.Workspace.PartV
local a = platechosen.CFrame
local b = targetBrick.CFrame
local step = 100
for i = 1, step do
platechosen.CFrame = a:lerp(b, i/step)
wait()
end
Consider basing the speed of your transition off time?
For now, the duration and speed of your transition depends on your step variant, not a specific amount of time you give it. If however we wanted to base our duration off time, it would be much more convenient and aesthetically pleasing. For a nice smooth transition, you should use BindToRenderStep from RunService, and replace your second argument of lerp with the quotient of how much time has elapsed, and your given duration time. Here's an example:
local RunService = game:GetService("RunService")
local RS_Key = "TweenCFrame"
local PointA = workspace:WaitForChild("PointA")
local PointB = workspace:WaitForChild("PointB")
local function TweenCFrame(Object, Position, Duration)
local Start = tick()
local Pos = Object.CFrame
RunService:BindToRenderStep(RS_Key, 2000, function()
local Elapsed = tick() - Start
local Progress = math.min(1, Elapsed / Duration)
if Progress == 1 then
RunService:UnbindFromRenderStep(RS_Key)
end
Object.CFrame = Pos:lerp(Position, Progress)
end)
end
TweenCFrame(PointA, PointB.CFrame, 10)
Hope this helped, if you have any questions, just let me know!
2 comments
"platechosen.CFrame = a:lerp(b, 1/step)", the "1/step" should be "i"
Guess I missed that in the edit, thanks for pointing it out.