This script is designed to lerp the position of a part between two target locations; where plat is the part, pos1 is the first position, pos2 is the second position, dur is the duration of the movement from one location to the next and back, and NUMBER_OF_BETWEENS is the amount of positions shown in between the target positions.
local plat=script.Parent--Part
local pos1=plat.Value1.Value--Target Position 1
local pos2=plat.Value2.Value--Target Position 2
local dur=plat.Dur.Value--Total duration of one loop
plat.Position=pos1--Set the part position to the first value
local NUMBER_OF_BETWEENS=100--Amount of "in between" positions
while true do
wait(dur/(NUMBER_OF_BETWEENS*2))--Wait for an amount that goes with the duration
for i=0,1,(1/NUMBER_OF_BETWEENS) do--loop i from 0 to 1
plat.Position=pos1:Lerp(pos2,i)--This SHOULD set the part position to the lerped amount
end
for i=0,1,(1/NUMBER_OF_BETWEENS) do
plat.Position=pos2:Lerp(pos1,i)--same as before but the opposite direction
end
end
When the script is run, the part is set to the first value, and the loop runs constantly, BUT, the part position is not updated as the loop runs. I do not see any bugs, but I am wondering if I am missing some concept.
Is there a minimum wait() duration? I don't know whether this would affect it but that's why I'm asking
Can the part position not be set to the lerped position?
Thank you for any responses! :)

3 comments
This makes sense, I'll try it out. I think I just had the wait in the wrong place. The wait in each loop would be the dur/NUMBER_OF_BETWEENS*2 so that it loops took a controllable amount of time to execute rather than executing as fast as possible.
It worked. Thanks!
No problem! Glad i could help you :D