I want to make a cframe lerp door system that uses the for loop. However, there is a problem when the third argument for the for loop is smaller than 0.1.
Example 1: for i = 0, 1, 0.1 do print(i) end, last print is 1
Example 2: for i = 0, 1, 0.01 do print(i) end, last print is 0.99
I do not know why it’s not doing it correctly, maybe it’s to do with low decimals
Anyways to solve your problem you could still use example 1 but divide i by 10, example:
The last number is actually .99 + 6.6613381477509e-16, so adding .01 would bring it over 1. Floating-point precision is the cause of the problem here. You can get around it by looping over the integers from 0 to 100 and dividing by 100.