Current Camera Issue

Problem: The local script puts the player’s current camera to a specific part when they spawn, so all they have to do is click play to get out of that “cutscene” but, when they reset or their humanoid dies, the camera goes back to that part. Is there a way I could stop this from happening?

Local script:

while wait() do

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable

workspace.CurrentCamera.CFrame = workspace.Cutscene.CFrame

end

local Button = script.Parent

while wait() do
  if Button.Visible == true then
    workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
    workspace.CurrentCamera.CFrame = workspace.Cutscene.CFrame
  end
end

Once the button turns invisible (after they press on it I suppose), the camera should get back to them.

1 Like

RenderStepped should be used in this case, as explained below:

The RenderStepped event fires every frame , prior to the frame being rendered. The step argument indicates the time that has elapsed since the previous frame.

RenderStepped does not run in parallel to Roblox’s rendering tasks and code connected to RenderStepped must be executed prior to the frame being rendered. This can lead to significant performance issues if RenderStepped is used inappropriately. To avoid this, only use RenderStepped for code that works with the camera or character . Otherwise, RunService.Heartbeat should be used.

2 Likes

Seems to have solved the issue thanks!