What do you want to achieve? Keep it simple and clear!
I’d like to make a menu screen for my newest game, which is a work in progress. This game is for fun, and soon, I hope to publish it among all.
What is the issue? Include screenshots / videos if possible!
Unfortunately, my menu screen involves setting the current camera of a player LOCALLY, which I don’t know how to do. I’d like to know how to set a current camera on client side so I know how to do my menu screen!
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I’ve searched toolbox for references, I didn’t find any.
I probably should have mentioned that for me it likes to complain that the CFrame I’d like to set it to doesn’t exist somehow, if it were just a CFrame value or a CFrame attribute of a part. Had this problem multiple times in other games
It does either one depending on how I tried to solve the issue, whether it was using a CFrame value and it wasn’t setting it properly (i.e. doing nothing) or trying to set it to a part’s CFrame, which would error
That is what the Scriptable cameramode is for, in that state the player can’t move the camera around, and it will stay in its set CFrame, its useful for menu screens, cutscenes, etc. and you can set the cameratyoe back to the default one after.
In this case i’m guessing you forgot to set the camera type to Scriptable since you said it didn’t error, it probably did change its CFrame but only for a fraction of a second before recalculating the player’s camera movement automatically back to a natural position. To avoid that just set the camera to Scriptable mode.
As for that, i’m not really sure since i don’t know how you tried to do it, you probably tried to access the part before it loaded on the clients part and it errored? that could be a reason and it is easily fixed by using :WaitForChild("PartNameHere") so that it waits till it finds it.
Other methods are just switching workspace’s current camera to another camera that you have created in studio for example, but it would still need to have its camera mode set to Scriptable so it is static.
I have no errors, since this is a new game baseplate I’ve recently created today, I haven’t tested it out. But I know from recent incidents this HAS happened before, and it’s incredibly annoying.
-- Player Variables
local players = game.Players
local localplayer = players.LocalPlayer
local playercframe = localplayer.Character.HumanoidRootPart.CFrame
local camera = game.Workspace.CurrentCamera
local camcframe = script.CamCFrame
-- Other variables
local label = script.Parent.MenuTitle
local module = require(game.ReplicatedStorage.CameraShaker)
-- Init
camera.CameraType = "scriptable"
camera.CFrame = camcframe.Value
It should be “Scriptable” with an uppercase S, you could also use Enum.CameraType.Scriptable because it provides autocompletion, but it’s just preference, both ways can be used as far as I know.