Making camera update to part without while true do

Hello everyone, i am wondering, how would i be able to have the camera position update to a parts position frequently without a while true do loop.

What i am trying to achieve is for the camera to move with the part that is being tweened for my main menu camera manipulation.

This is what i have:

local Camera = game.Workspace.CurrentCamera 
local Player = game.Players.LocalPlayer

repeat wait() until Player.Character

while true do
Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.Cameras.Cam.CFrame
wait(.001)
end

RunService:BindToRenderStep()

local RunService = game:GetService("RunService")

function UpdateCamera()
    Camera.CFrame = workspace.Camera.Cam.CFrame
end

RunService:BindToRenderStep("CameraUpdate", Enum.RenderPriority.Camera.Value, UpdateCamera)
1 Like

Ok sure. I will give that a try.

Thank you for answering this. It worked but i have 1 question. How would i make it stop when i call an event or something? (this is for a main menu)

RunService:UnbindFromRenderStep("CameraUpdate")

1 Like

Ok thanks. Now I am going to mark your 1st message as the solution.

1 Like