this is my menu screen.
here is the code.
for some reason a players camera sometimes wont set and I will get the warning in console “ActivateCameraController did not select a module” or something along those lines.
This has been an unfortunate huge issue throughout the past, and still continues to this day sadly
Try this perhaps?
local Camera = workspace.CurrentCamera
local focus -- Set your focus thingy here
local CurrentAttempts = 0
local MaxAttempts = 10
while CurrentAttempts < MaxAttempts do
local success, whoops = pcall(function()
Camera.CameraType = Enum.CameraType.Scriptable
end)
if success then
print("Successfully changed the Camera's CameraType!")
Camera.CFrame = focus.CFrame
break
else
CurrentAttempts += 1
end
if CurrentAttempts == MaxAttempts then
warn("Max attempts reached, could not change the Camera Type")
break
end
wait(1)
end
I believe it’s just a matter of yielding when to set the specific Cameras, most people use wait() as a temporary solution but unfortunately that doesn’t really solve the official case
Only other thing I can think of is waiting for all Instances to properly loaded within the client, or using ContentProvider:PreloadAsync() to properly load all of it’s assets within the game
if not game:IsLoaded() then
game.Loaded:Wait()
end
Complicated loops are more than you should need. Someone had this issue months ago and the simple solution I gave to them was that you should wait for the player’s character to load before running camera scripts. This gives ample time for camera modules to load, but is fast enough that the player isn’t waiting around for your camera scripts to work. I will try to find my responses to the other person and I will link them here.
Just for the sake of it, have you tried adding a wait(1) before setting the Camera?
If PreloadAsync() didn’t literally somehow manage to work either, maybe you can try this if you haven’t already?
-- LocalScript inside StarterPlayerScripts
local Cam = workspace.CurrentCamera
local focus -- Set your focus part here
local ContentProvider = game:GetService("ContentProvider")
local AssetsToLoad = {
Cam,
focus,
-- Other assets to load which may work better since it yields longer --
}
ContentProvider:PreloadAsync(AssetsToLoad)
Cam.CameraType = Enum.CameraType.Scriptable
Cam.CFrame = focus.CFrame
Maybe the character is loaded after the loop ends and this resets the camera type to custom or other, my only solution is to keep changing the camera type to your specified type over and over, although this is not efficient but it’s still made in the client + It’s just for the main menu, it shouldn’t be that bad since that’s currently the ultimate solution.