Hello Roblox Community! This is probably a very quick topic to answer, but I’m trying to get a project finished in about 3 hours from now and am fairly stumped on turning the player’s camera to the front surface of a part from the start of the game until they leave.
When I currently join the game, nothing happens and no errors appear in the output, so I assume it’s not an issue the output is detecting, and something is wrong with my logic or CFrame.
Currently the part “Cutscene1” is just in workspace, and the script is a LocalScript in StarterGui.
I did a quick skim of the internet and couldn’t find a working fix, so I decided to ask here to find help. Thank you in advance, code is down below! ~Boba
local camera = game.Workspace.Camera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(game.Workspace.Cutscene1.Position)
game.Workspace equates to workspace, which reduces character count, and one that I use. It’s a global variable created by Roblox. (although, it really just depends on yourself if you’d want to use it or not)
You should use workspace.Currentcamera to access the camera, not workspace.Camera.
Setting the CameraType can be unreliable because it can sometimes set it before the character spawns in, and when it does, the CameraType will revert back to Custom. To fix this, you can set this on top of your script instead of waiting for 5 seconds, which is more reliable.
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()