I'm trying to make a part move when the player presses the A key and I want to use linear interpolation to do it, which I'm not very familiar with. The code below moves the part to the desired position but then pauses for a few seconds before it can move again, and I'm not really sure why. How do I make the part move continuously?
function lerp(direction) local pos = a.Position + Vector3.new(50,0,0) for i = 1,100 do if holdingA == true then local alpha = i/100 a.Position = a.Position:Lerp(pos, alpha) print(pos) wait() end end end uis.InputBegan:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.A then holdingA = true while holdingA do lerp() wait() end end end) uis.InputEnded:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode.A then holdingA = false end end)