Hello!
I am currently writing a script that teleports your camera to a location when you click on a part.
To accomplish this, I am using Vector3 and CFrame to manipulate the camera’s position and orientation.
The position part of the script works completely fine, however the orientation part of the script sets it at a weird angle, even though the orientation Vector3 is set to (0, 0, 0).
Here is my code:
local re = game.Workspace.ClickPart.ClickDetector.Script.RemoteEvent
re.OnClientEvent:Connect(function()
print("Signal received.")
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local position = Vector3.new(-1533.95, 0.5, 783.06)
local orientation = Vector3.new(0, 0, 0)
local cameraCFrame = CFrame.new(position, orientation)
workspace.CurrentCamera.CFrame = cameraCFrame
end)
Here are also some pictures for reference:
Above: What is happening.
Above: What it’s supposed to look like.
I have tried looking everywhere, but I can’t find a good solution.
Can someone help me? Thanks!