So no errors, but I can’t seem to get my part here to tween and face the other part. Some issue with my CFrame.fromEulerAnglesXYZ();
I’m just trying to rotate the Y axis so that it simply turns and faces a part on a flat plane essentially. But while it does rotate it doesn’t rotate and face my part. What am I doing wrong here? Thank you.
wait(3)
local tweenService = game:GetService("TweenService")
local part1 = script.Parent
local part2 = game.Workspace.FacePart -- The part that part1 will face
local rotation = CFrame.lookAt(part1.Part.Position, part2.Position)
local x,y,z = rotation:toEulerAnglesXYZ()
local goal = part2.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(y), 0)
local info = TweenInfo.new(4, Enum.EasingStyle.Linear) -- Tween for 4 seconds with linear easing
local tween = tweenService:Create(part1.Part, info, {CFrame = goal})
tween:Play()