I'm needing help with an effective means of CFrame animations. Current animation scripts I've made have looked something like this:
1 | part = script.Parent |
2 |
3 | part.CFrame = CFrame.new( 0 , 0 , 0 ) |
4 | wait( 0.1 ) |
5 | part.CFrame = CFrame.new( 0 , 0.1 , 0 ) |
6 | wait( 0.1 ) |
7 |
8 | end |
and continuing on like that until a certain point in which it stops. It also ends up being a really bad animation, ending up looking as though it's teleporting in very small steps.
Any help is much appreciated.
~kl4331
Any time you are going to be repeating an action, use a loop.
1 | local part = script.Parent |
2 | for i = 1 , 100 ,. 01 do --Read about how this works at the loop link |
3 | part.CFrame = CFrame.new( 0 , i, 0 ) |
4 | wait() |
5 | end |
Unfortunately, there are no easy ways to do non-linear animations (all require math). Hah! Just kidding! We can just get a module to do that stuff for us!