So I was working on a game intro and the script is fine, but the camera does not always work. So it shows the character, and it is not supposed to do that. Heres my script
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = game.workspace.Cameras.TitleScreenCamera.CFrame
Camera.CameraSubject = game.Workspace.Cameras.TitleScreenCamera
well for 1 you dont need to loop setting the camera type. Try just adding a wait for like 1 second at the top of the script. see if that fixes. Sometimes the game loads too fast or too slow and can cause problems with the script.
Usually ill do this at the top of my local scripts.
repeat wait() until game:IsLoaded() wait(1)
then put the main code below. Usually works fine.
You can try waiting for the Humanoid. That delay might be enough.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local character = player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = humanoid.RootPart
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.Cameras.TitleScreenCamera.CFrame
A simple camera script. This will just set it to the part, won’t do anything fancy. Just put the script in StarterCharacterScripts and it will wait until the character is loaded (meaning the camera should be too)
local player = game:GetService("Players").LocalPlayer;
local part = workspace.Part;
local camera = workspace.CurrentCamera;
camera.CameraType = Enum.CameraType.Scriptable;
camera.CameraSubject = part;
camera.CFrame = part.CFrame;
Edit: edited the code to add the one whole line of code since @magicalmariomario said my code didn’t work.
Did you test your own script? It doesn’t work. Yes, it’s a LocalScript in StarterCharacterScripts.
It seems like your script bugs out because you used CameraSubject. You should replace it to CFrame for no more errors.
Edit: Scriptable does not move your camera to the CameraSubject. CFrame must be directly changed.
I did test it, again, I said it doesn’t do anything fancy, it just gets you into scriptable so that the OP can change it to do what they want.