Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's the equivalent of Tweening for bricks?

I really don't want to manually set up "for i = 1, 80" loops for all of these... Is there any way I can gradually change a model's position so that it lines up with another block?

1 answer

✓ Accepted answer

Tweening

The only difference is, you will have to do this manually. BaseParts do have no built-in method for tweening their properties, however you can easily implement one based on CFrame:lerp()

function TweenCFrame(Part, End, Time)
  local i = 0;
  local init = Part.CFrame;
  while i < Time do
    Part.CFrame = init:lerp(End, TweenFunction(i/Time))
    i = i + wait()
  end
  Part.CFrame = End
end

The TweenFunction can be any easing function which takes a fractional part. Try this one:

function TweenFunction(i)
  return i^2
end

It's simple, but it'll help your tweening look smoother.

1 comment

0

TERRIBLY sorry, I thought I accepted your answer already. Better late than never, I suppose.

This discussion is preserved as it was. New answers, comments, and votes are closed.