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

Help with a CFrame animation?

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

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!

1 comment

0

Haha, cheers.

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