function tween(part,pos,tim,stop) --stuff
local function stuff() --for the stopige
local runs = 100 --smoooth
local ToTake = runs*.03 --time it will take
if ToTake>tim then
repeat
runs=runs-1
ToTake = runs*.03
until ToTake<tim --gets closer to tim
else
repeat
runs=runs+1
ToTake = runs*.03
until ToTake>tim
end
local cf = part.CFrame --start cf
for q=runs,0,-1 do
wait()
part.CFrame = pos:lerp(cf,q/runs)
end
end
if stop then --stop! In the name of lo-o-o-ove
stuff()
else spawn(stuff)
end
end
return tween
The above is a moduleScript. The purpose of it is to smoooooothly move parts. It works fine, but if I do something like this.
p1 = game.Workspace:WaitForChild("Part")
p2 = game.Workspace:WaitForChild("Part2")
tween = require(game.ReplicatedStorage.tweens)
start = tick()
tween(p1,p2.CFrame,10,true) --it has to pause here
print(tick()-start) --print 11.3
So, does anybody know how I could improve the accuracy of the time?

2 comments
Oh, thank you. I never thought about using tick() in a function before. Also, why the semi colons?
Habit from other programming languages