My camera script only works some of the time?

My script only changes the current camera about 80% of the time. I’m pretty sure it’s because the script is running before the player loads in but I added Player.CharacterAdded:Wait() and the script is also repeating until Camera.CameraType == Enum.CameraType.Scriptable yet I’m still running into this issue.

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Camera = workspace.CurrentCamera

repeat wait()

Camera.CameraType = Enum.CameraType.Scriptable

until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CFrame = workspace.AvatarCreator.CameraPart1.CFrame

try connecting Player.CharacterAdded to a function instead of Wait() to give it more time to load

1 Like

You don’t really have to use a loop to change the camera type.

You can remove the “repeat until” and check if it works.

1 Like

I know this is a hacky fix but I usually add a wait(2) at the start of every custom camera script I create, The reason it works some of the time is because some clients avatars don’t load in time even if you added a wait this may only work some of the time for those potato-powered devices.

Is it possible if you can give details where the script is located? nvm

1 Like