I'm trying to make a walking animation with CFrame, without the animation plugin, and since I'm new to this I don't know why I can't set the CFrame of the shoulder more than once.
Run.RenderStepped:connect(function() leftArm.C1 = CFrame.new(0,0.5,-0.5) * CFrame.Angles(0,0,-math.pi/4) wait(2) leftArm.C1 = CFrame.new(0,0.5,-0.5) * CFrame.Angles(0,0,math.pi/4) end)
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)--starts off at 0 and runs until it reaches 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.