Of course, you can ask if you have any questions.
In short:
- Don’t use renderstepped because it runs prior to anything else in-game rendering. TLDR: BAD!!!
- you can use task.wait to represent frames, but this isn’t the best solution for your case. just putting it out there.
- Frame values are really just 1 / fps, so 240 fps is just 1 / 240 and 60 fps is 1 / 60
- :Lerp(), or in mathematics, Linear Interpolation, is the process to find a point between two points at a certain value.
- I.e. lerping with a 3rd value of .4 will give a result that is 40% of the path from A->B
- You were calculating the 3rd input with exponents, meaning sometimes it would be .01 or other times .8, which is a huge difference
My solution was very simply:
- Instead of lerping with a value that is very volatile (.01 at 240 fps, and .8 at 60 fps), i simply changed the calculation to be less harsh.
- The code i provided not only clamps the value, so that it cannot go outside given min and max, but also doesn’t use exponents so the value is more controlled.
Hope this helps!