CFrame Part not rotating correcting

I’m trying to get a part to spin around horizontally.

But it proceeds to do this instead.

So I’ve tried to enter the rotation value into different parts of the CFrame I set up, but nothing seems to work.

local part = script.Parent

local TweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

local tween = TweenService:Create(part, tweenInfo, {CFrame = CFrame.new(part.Position, Vector3.new(0,0,180))})

tween:Play()

The second parameter in the CFrame.new is a LookVector to look at a certain position, you can make the goal tween like this instead…

CFrame = part.CFrame * CFrame.Angles(math.rad(180),0,0)

I’m not sure how your part is set up, so if it rotates in the wrong direction you will just have to swap the parameters until you get it correctly.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.