How To Rotate A Part On A Local Axis

I was wondering how I would rotate a part on a local axis with a tween. However, whenever the tween plays, the part does not rotate. As shown in the picture I want to rotate the part on one of the local axis (specifically the green one).
image

local WhirlTween = TweenService:Create(WhirlEffect, TweenInfo, {Size = Vector3.new(13,.1,13), Transparency = 1, CFrame = WhirlEffect.CFrame * CFrame.Angles(0, math.rad(-360), 0)})
	WhirlTween:Play()
end)

Maybe this?

Part.CFrame = Part.CFrame * CFrame.Angles(0, math.rad(15), 0)

What you’re referring to is the object’s object space.

local Part = Instance.new("Part")
Part.CFrame = Part.CFrame:ToObjectSpace() * CFrame.Angles(math.pi / 2, 0, math.pi / 2)
Part.Parent = workspace

Here’s a very simple script which rotates a part instance (according to its object space), 180 degrees around both X and Z axis.

Here’s a resource to learn more.

1 Like