Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with a CFrame animation?

Asked by 9 years ago

I'm needing help with an effective means of CFrame animations. Current animation scripts I've made have looked something like this:

1part = script.Parent
2 
3part.CFrame = CFrame.new(0,0,0)
4wait(0.1)
5part.CFrame = CFrame.new(0,0.1,0)
6wait(0.1)
7 
8end

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

1 answer

Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
9 years ago

Any time you are going to be repeating an action, use a loop.

1local part = script.Parent
2for i = 1, 100,.01 do --Read about how this works at the loop link
3    part.CFrame = CFrame.new(0, i, 0)
4    wait()
5end

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!

0
Haha, cheers. BritishActuaI 44 — 9y
Ad

Answer this question