Okay, so normally if i'd want something to continually rotate, I would use something like
for i = 1,15 do object.CFrame = Object.CFrame *CFrame.Angles(0.1,0,0) wait(.1) end
What i'm wondering is, is there a way outside of this method to make something rotate? This way gets the job done but I feel as though it's really choppy and not smooth at all.
Options:
wait()
, which will wait for approximately 0.03 seconds (this will update 3x more frequently than what you are currently doing)game:GetService("RunService").Heartbeat:Connect(function(step) object.CFrame = object.CFrame * CFrame.Angles(0.02,0,0) end)
You can also improve the animation quality by doing rotation based on the amount of time that has elapsed. ex, wait()
actually returns this, and you can use the step
argument for the same purpose. ex, instead of doing * CFrame.Angles(0.02, 0, 0)
, you might just do * CFrame.Angles(step, 0, 0)
. This way, if the game slows down or lags, the animation will still continue at the same speed (though obviously choppier).
[Edit: greatneil80 is right, you can also use the TweenService to rotate, though you'd have to update it pretty much every frame if you wanted something to rotate indefinitely. Still, you could combine it with the wait()
for loop if you wanted to avoid using the RunService.]