how could I get the player's camera rotation?
Thanks,
Exsius
Its not a rotation property but Its the CFrame called CoordinateFrame
you can use it like
camera.CoordinateFrame = CFrame.new(0, 0, 0)--x pox, y pos, z pos
CFrame have more than three numbers(position), they have others numbers used for the rotation
You can set the rotation by using this function:
camera.CoordinateFrame = CFrame.new(0, 0, 0) *CFrame.Angles(math.pi, 0, 0)--math.pi is 180 degree
You can also use math.rad
a function in the math library
camera.CoordinateFrame = CFrame.new(0, 0, 0) *CFrame.Angles(math.rad(180), 0, 0)
Don't forgot to put your cameratype at Scripting for make it work
camera.CameraType = Enum.CameraType.Scripting
If you need to know more about CFrame
or on the Camera
you can use roblox wiki
Code:
--Make sure to put it in a local script in your player to make it work local camera = game.Workspace.CurrentCamera wait(1) camera.CameraType = Enum.CameraType.Scripting camera.CoordinateFrame = CFrame.new(5, 2, 1) *CFrame.Angles(0, math.pi, 0)