Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to reset a Player's Camera after setting the CFrame?

Asked by 6 years ago

Hey, I was recently messing around with some basic scripts for setting the Camera's CFrame (mainly for main menu type things), and while setting it does work, I have not been able to successfully reset the Player's Camera back to their character. I've tried multiple different things, such as changing the properties, destroying CurrentCamera, and a few other things, which do not seem to work. Any suggestions as to how I could reset it?

All of the scripts below are in a LocalScript.

Code (for setting the CFrame):

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = CFrame.new(-276.006775, 14.0770245, 81.1118164, -0.934831619, -0.00371354632, 0.355072141, -0, 0.999945462, 0.0104579963, -0.355091572, 0.00977646559, -0.934780478)

Code (for attempting to set the camera back)

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Fixed
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid

Code (destroying the camera)

game.Workspace.CurrentCamera:Destroy()

Thanks. :)

1 answer

Log in to vote
0
Answered by 6 years ago

Set the CameraType to Custom.

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
0
Thanks. :) InfinitivePixelsJr 542 — 6y
Ad

Answer this question