✓ Accepted answer
So I assume you want the frames to change every 2 seconds judging by your wait(2) line.
function animate(step, last)
if step == 0 then
leftArm.C1 = CFrame.new(0,0.5,-0.5) * CFrame.Angles(0,0,-math.pi/4)
wait(2)
if step ~= last then
animate(step+1)
end
elseif step == 1 then
leftArm.C1 = CFrame.new(0,0.5,-0.5) * CFrame.Angles(0,0,math.pi/4)
wait(2)
if step ~= last then
animate(step+1)
end
end
end
animate(0,1)
The benefit of this over RenderStepped is that it allows you to add wait() commands, and also if you want to add another frame, you'd just add another elseif block with step == 2 (in this case) and then change the CFrame. The only downside I can see to this method is that if you want to add another frame in between 2 frames, you'll have to increase all of the step numbers in the blocks after the one you added by 1. But even if this was a for loop, you'd still have to do that anyway, and I just wrote it this way because I personally prefer recursive functions over standard loops.
This solution is what you are asking for, but in all honesty, learning the animation plugin is probably going to make this process a whole lot easier than you realize.
2 comments
The wait(2) on line 3 won't "pause" RenderStepped. The RenderStepped event will continue firing.
you could make it recursively run through the animation and end when it is complete, I'll type it up for you right now