rotating by using :Lerp() or TweenService works the same.
Here is code:
local TweenService = game:GetService("TweenService")
local cd = script.Parent.CD
local shown = script.Parent.Shown
local hidden = script.Parent.Hidden
local tInfo = TweenInfo.new(.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local newTween = TweenService:Create(shown, tInfo, {CFrame = hidden.CFrame})
cd.MouseClick:Connect(function()
newTween:Play()
end)
I know, script place is in Model but it’s only for testing. Later I will use rotating to the system.
You can determine a goal in TweenService if you want to change multiple parameters such as in your case are Position and Rotation. :Lerp() function shouldn’t be used since it is a worse version of TweenService and there has been many topics about it already in the past. Here is an example of a TweenService:
local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.new(1, 0, 0)
part.Anchored = true
part.Parent = game.Workspace
local goal = {}
goal.Position = Vector3.new(10, 10, 0)
goal.CFrame = part.CFrame * CFrame.Angles(0,math.deg(math.pi), 0)
local tweenInfo = TweenInfo.new(1)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()