Maybe you could try setting the CFrame, CameraSubject, and CameraFocus too
local CameraCFrame = Camera.CFrame -- This variable needs to be set before changing the CFrame
Camera.CameraSubject = Humanoid -- Define the Player's Humanoid
Camera.Focus = HumanoidRootPart.CFrame -- Define the Player's HumanoidRootPart
Camera.CFrame = CameraCFrame
I believe you misunderstood my question. Functions can be called throughout the code. For example:
function enableCustomCam()
repeat
wait();
Camera.CameraType = Enum.CameraType.Scriptable;
until Camera.CameraType == Enum.CameraType.Scriptable;
Camera.CFrame = workspace.Part.CFrame;
end
function disableCustomCam()
repeat
wait();
Camera.CameraType = Enum.CameraType.Custom;
until Camera.CameraType == Enum.CameraType.Custom;
end
while wait() do
if menuCam then
enableCustomCam()
else
disableCustomCam()
end
end
It could be because you’re using a server script to change the camera back to the player. Each player has their own camera, so you can’t edit it from a server script.
Consider defining functions locally and using task.wait() (1/60th of a frame delay) instead of wait() (1/30th of a frame delay). Alternatively you can use RunService.RenderStepped:Wait() (which also yields for 1/60th of a frame) which is purposed for camera-related scripting.