Rotate a part on Y axis 180 degrees

I have a script that Tweens the player’s character to the desired part, although the player turns in the process. I want to rotate the target part by 180 degrees, so the problem solves.

Try:

TargetPart.CFrame = (TargetPart.CFrame * CFrame.lookat(MouseHit.Position,Character.HumanoidRootPart.Position)) * CFrame.fromOrientation(0,math.rad(180),0)

Took the script from one of your posts

Instead of rotating the target part, you can keep the character rotation constant during the tween:

local r = math.rad 
local o = Character.HumanoidRootPart.Orientation --orientation in degrees
local angles = CFrame.Angles(r(o.X), r(o.Y), r(o.Z)) --CFrame.Angles accepts rads
local goalCFrame = CFrame.new(Part.Position)*angles 
--use goalCFrame as the tween goal 

Part.Orientation + Vector3.new(0, 180, 0)

As simple as rotating the part 180 degrees around the y-axis using a Vector3 value and the “Orientation” property of the BasePart instance.

1 Like