Hi, what I'm trying to do is tween a part's orientation. I'm not using SetPrimaryPartCFrame because it's not in a model, and I want to tween it over time. I don't want it to happen instantly. How would I go about tweening the position and orientation. It's kind of like tweening it on a hinge point or locking it's rotation around a single corner of it. Here is what I have so far, but it throws an error.
local main = script.Parent.Parent.Main local TweenService = game:GetService("TweenService") local info = TweenInfo.new(3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0) local to = { Position = CFrame.new(-387.251, 1189.812, -627.261), Orientation = CFrame.Angles(57.5, 180, 180) } local openBox = TweenService:Create(main,info,to)
A CFrame is both position and rotation. They are far more flexiable that just setting the position and orientation.
The error is due to Position and Orientation being Vector3 types and you are passing it a CFrame.
You can use the following to create a CFrame and change its rotation. Note that CFrame.Angles is in radians so you may need to use math.rad([degrees]).
local to = { CFrame = CFrame.new(-387.251, 1189.812, -627.261) * CFrame.Angles(57.5, 180, 180) -- change this to radians }
I hope this helps. Please comment if you have any other questions about this post.