Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn´t the camera rotate?

I have recently made a camerapart, and attached the currentcamera to that part. Which works fine however, I also want to be able to rotate the camera, but the script doesn´t work.

local Player = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera
local CameraObject = game.Workspace.CameraObject
local TweenService = game:GetService("TweenService")

Player.Character:Destroy()
wait(5)
Player.Character.Humanoid.Health = 0


repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable


Camera.CFrame = CameraObject.CFrame

wait(10)
CameraObject.CFrame = CFrame.Angles(30,30,30)

1 answer

✓ Accepted answer

Hey Andrius, in order to change a camera's CFrame you need to multiply the camera's current CFrame with the Angles you desire.

CameraObject.CFrame = CameraObject.CFrame * CFrame.Angles(30,30,30)

Keep in mind CFrame.Angles takes radians so if you want to change the Angles by 30 degrees you will need to use math.rad

CFrame.Angles(math.rad(30),math.rad(30),math.rad(30))

1 comment

0

Oh, thanks :).

This discussion is preserved as it was. New answers, comments, and votes are closed.