How do I rotate a part using TweenService?

Hello fellow robloxians,

How do I rotate a part using TweenService?

So I once tried soemthing like this:

local goals = { Orientation = Vector3.new(8,0,0)}

Of course, that wasn’t the whole script, but I need help on how to rotate a part using TweenService.

I dont know what I did wrong, but it didn’t rotate when I runned it. Thanks you developers.

Heres a picture of teh code:

Generally, If you want to rotate any parts, you use its CFrame properties. In your case, simply do

local goals = { CFrame = CFrame.Angles( __ , __ , __ ) + script.Parent.Position } 

if you want to rotate it. (the values are in radians if I remember correctly).
However, if you want to make it point another part, you can use CFrame.lookAt instead. You can learn more about this in a wiki page called “Understanding CFrame”.

1 Like

Something happend. it like moved to another place. IDK why it happend i put local goals = { CFrame = CFrame.Angles( 1,0,0) }

Or am I mis understanding something?

(edit i meant cframe.angles(1,0,0)

Oh yeah that’s why I edited in the
CFrame.Angles( _, _,_ ) + script.Parent.Position
, because CFrame contains both position and rotation value. CFrame.Angles have a position value of 0, 0, 0 so you need to add in your part’s position aswell.

I’d actually suggest going for:
{CFrame = script.Parent.CFrame * CFrame.Angles(2,0,0)}

Also I think CFrame.Angles works in Radians not degrees. You’d have to double-check documentation for that.

Ok thanks you all guys. I didnt know that bc I only watches like 1 tutorial on TweenService

2 Likes

Ah yeah you can do this too, this one will rotate the part relative to itself ( basically just turn 2 radians from current rotation + position) which I believe is more useful in most cases.

you’re in the wrong channel. use scripting support next time. this channel is for posting creations/looking for feedback of your creation.

1 Like

Put math.rad in between the number of rotation.

CFrame = CFrame.Angles(math.rad(65), 0, 0)

edit; I didn’t type the whole thing I’m on phone rn