I want to make a part that loops rotation with cooldown, And I dont Know How To Rotate CFrames. Please Help me to Rotate Looping CFrames, I hope i Get some Help.
How to Rotate Parts with CFrame?
3 answers
Just use orientation.
Examples:
workspace.Part.Orientation = Vector3.new(90,90,90) workspace.Part.Orientation = workspace.Part.Orientation + Vector3.new(10,90,10)
also you can tween it
local TweenService = game:GetService("TweenService")
local goal = {} goal.Orientation = workspace.Part.Orientation + Vector3.new(360,720,1440) local info = TweenInfo.new(3, Enum.EasingStyle.Linear,Enum.EasingDirection.Out) local tween = TweenService:Create(workspace.Part,info,goal)
Right, In order to understand how CFrame works, it's that CFrame isn't just about position. It also takes Rotation and Position (and some other things) into account. So change rotation with CFrame, you'll need to do CFrame.Angles (Similar to how you use CFrame.new.) I'll give you an example:
local part = workspace.Part
part.CFrame = CFrame.Angles(90,90,0) --The problem with this is that the Angles is in Radiants, not degrees. So to solve this issue, use math.rad().
part.CFrame = CFrame.Angles(0,math.rad(90),0) --This is the correct way to use CFrame.Angles().
Also, if you do it this way mentioned above, it will reset the part back to the position (0,0,0). So if you wanna keep the CFrame, use this below:
local part = workspace.Part
part.CFrame = part.CFrame * CFrame.Angles(0,math.rad(90),0) --This will keep the position of the part, and change the rotation. the * means add. So you're just adding angles.
1 comment
How do i making it Rotate with: X? Y? Z?
CFrame.Angles is what you would do, simply do
SomePart.CFrame *= CFrame.Angles(math.rad(1), 0, 0)
The reason why i use math.rad is because it turns Radians into Angles which CFrame.Angles uses so it makes it more comfortable for use, you don't have to use it tho.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you! I made a looping rotating part.