If you want to change what the player seeâs via their camera you could do:
local Player = game:GetService('Players').LocalPlayer
local PlayersCurrentCamera = workspace.CurrentCamera
local PartToMakeCharacterView = workspace.PartToMakeView
PlayersCurrentCamera.CFrame = PartToMakeCharacterView.CFrame
This should give you a basic understanding, if you want a player to be able to view a certain area, you can put a part in that area, angle it how you want, then change the current cams CFrame. If this is the solution be sure to mark it as the solution!
With the code I gave you above, you donât need to do put anything in but a part, and replace local PartToMakeCharacterView = workspace.PartToMakeView, specifically workspace.PartToMakeView with where you stored & named the part youâre trying to make the character view. The script I posted above will simply get the Players Current Cam, and make the CFrame equal to that of the part. Be sure itâs a local script inside of StarterPlayerScripts!
Yes it would! One thing Iâd do to be safe is add a WaitForChild in-case the script runs before the game is loaded, you can do that by doing PlayersCurrentCamera.CFrame = workspace:WaitForChild("CameraFace").CFrame
:WaitForChild() will yield [stop] the script until CameraFace is found and loaded!
Itâs not working because PlayersCurrentCamera is the players current camera, but you currently have it to what youâre trying to make the CFrame of the current camera go to. You need to change local PlayersCurrentCamera = workspace.CameraFace to local PlayersCurrentCamera = workspace.CurrentCamera. So in the end this should be your full script:
local PlayersCurrentCamera = workspace.CurrentCamera
local PartToMakeCharacterView = workspace.CameraFace
PlayersCurrentCamera.CameraType = Enum.CameraType.Scriptable --Makes it so you can change the CFrame of the camera
PlayersCurrentCamera.CFrame = workspace:WaitForChild(âCameraFaceâ).CFrame --Changes the CFrame
This script is still not working and my script is a local script in starter player scripts and the name of it is camera and here is the code local PlayersCurrentCamera = workspace.CurrentCamera
local PartToMakeCharacterView = workspace.CameraFace
PlayersCurrentCamera.CameraType = Enum.CameraType.Scriptable --Makes it so you can change the CFrame of the camera
PlayersCurrentCamera.CFrame = workspace:WaitForChild(âCameraFaceâ).CFrame --Changes the CFrame