So I'm working on an exit system that moves the camera to a spot when you click exit
My code right now:
script.Parent.MouseButton1Click:Connect(function()
--// Main variables
local variablestorage = script.Parent.Parent.Parent.Parent.DealerDetector.Main
local campart2 = variablestorage.CamPart2.Value
--// Tweening camera
local TweenService = game:GetService("TweenService")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local tween = TweenService:Create(camera,TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),{CFrame = CFrame.new(campart2.Position),Focus = CFrame.new(10, 0, 0)})
tween:Play()
end)
This tweens it to the part, however the rotation is off, even though the front part of the object is facing the right way.
Here's what it looks like: https://gyazo.com/9e976fcade075fc1591e05f25bffaf91
Here's a image depicting how the parts are positioned: https://cdn.discordapp.com/attachments/718624178353340417/799670567526858792/unknown.png
Why does the rotation change? How do I fix it?

4 comments
Make sure the part is facing the front, and is straight.
It is which I showed in the example.
Maybe use the CFrame of campart2 instead of making a new one, like: CFrame = campart2.CFrame
Using CFrame.new creates a CFrame without rotation, and CFrame.Angles makes a rotated CFrame from radians, without the position. Multiplying the two gives a CFrame with both position and rotation.