I'm making a script that uses an equation to calculate the distance between 2 objects, then moves 1 object to the other in a certain Time, and the speed at which it goes to the other part is dependent on the Time. Problem is, these equations will often give numbers with a crazy amount of numbers after the decimal, this causes all sorts of weirdness, such as the part missing its target. How would I round up the numbers so I don't get such crazy numbers?
--Cup goes to position 1
local Time=4
local Distance=(math.abs(Cup.Position.X+Pos1.Position.X))
local StudsPer=(Time/Distance)
local TimeUp=0
------------
repeat
wait(StudsPer)
Cup.CFrame=Cup.CFrame*CFrame.new(0,0,StudsPer)
TimeUp=TimeUp+StudsPer
until
TimeUp>=Time
do Cup.Position=Pos1.Position--Ensures it gets there in case of bugs

4 comments
Just use math.floor() it rounds any number up!
math.ceil()*
guss i shall explain kaboobs
http://hastebin.com/isizivegov.lua