Hi, I’m making a new game and I wanted to make a menu that the player will be greeted with upon joining the game. I put a part in the position I wanted the player camera to be (which is the MenuCam part) and put it in a folder name “Menu” in workspace. When I tried to set the Camera CFrame equal to the MenuCam CFrame, it errors with this:
This IS written in a local script inside of StartPlayerScripts.
I’ve tried to fix it multiple times by adding FindFirstChild()
and/or WaitForChild()
I can confirm that neither of these work, FindFirstChild results in this error:
WaitForChild does absolutely nothing, so neither of these yield the desired result.
Here’s the kicker: I have another game with this EXACT same setup, and it works flawlessly. I can’t figure this out, and I’m thinking it’s just something wrong with the roblox engine at this point, I don’t know what it is. I’m here for suggestions of things that could be causing this.
Now I have written two scripts to accomplish this (I tried the first one, it didn’t work so I wrote the second one with higher hopes)
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
repeat wait()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = workspace.Menu.MenuCam.CFrame
camera.FieldOfView = 50
As previously stated, the above script does not work, and neither does the script below.
local players = game:GetService("Players")
local cam = game.Workspace.Camera
local menuCam = game.Workspace.Menu.MenuCam
players.PlayerAdded:Connect(function(player)
repeat task.wait()
cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable
print("Setting camera CFrame.")
cam.CFrame = menuCam.CFrame
cam.FieldOfView = 55
end)
If anyone has anything that might help me or somebody else who finds this later on, I would greatly appreciate it.
Disclaimer: I read a lot of other threads, and tried all of their solutions, they almost always consisted of the above solutions that I already tried, and as I stated before, they did NOT work.