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:

part = script.Parent

part.CFrame = CFrame.new(0,0,0)
wait(0.1)
part.CFrame = CFrame.new(0,0.1,0)
wait(0.1)

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

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.

local part = script.Parent
for i = 1, 100,.01 do --Read about how this works at the loop link
    part.CFrame = CFrame.new(0, i, 0)
    wait()
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!

0
Haha, cheers. BritishActuaI 44 — 9y
Ad

Answer this question