I did nothing wrong. I followed what you did.
you cant use a wait() inside a RunService:BindToRenderStep to change bewteen cameras
It’s because RenderStepped doesn’t wait for the code to finish running. It’s running so quickly, that there’s not enough time for the wait(3) to complete and set the camera, as it’s immediately reset back to Cam2. I suggest you use a while loop in this case, you do not want multiple instances of the code running at once.
local camera = game.Workspace.CurrentCamera
function UpdateCamera()
camera.CFrame = game.Workspace.Cam1.CFrame
task.wait(3)
camera.CFrame = game.Workspace.Cam2.CFrame
end
while true do
UpdateCamera()
end
The original script was on startergui. Should i put there?
Just change the script to the code I sent
did but it doesnt really show the camera. it only shows the player cam
i forget you dont need RunService:BindToRenderStep in this way just change the camera to scriptable and to custom to reset it
wait(2)
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local part1 = workspace:WaitForChild("Part1")-- cam position
local part2 = workspace:WaitForChild("Part2")-- cam focus
local part3 = workspace:WaitForChild("Part3")-- cam position
local part4 = workspace:WaitForChild("Part4")-- cam focus
function UpdateCamera()
camera.CFrame = CFrame.lookAt(part1.Position,part2.Position)
task.wait(3)
camera.CFrame = CFrame.lookAt(part3.Position,part4.Position)
task.wait(3)
camera.CameraType = Enum.CameraType.Custom
end
UpdateCamera()
Yes, you’re right, it fires every frame so it doesn’t have the time to do some task scheduler.
However, I hope this would be a solution.
local camera = workspace.CurrentCamera
local part1 = workspace:WaitForChild("Part1")
local part2 = workspace:WaitForChild("Part2")
while true do
task.wait(3)
camera.CFrame = part1.CFrame
task.wait(3)
camera.CFrame = part2.CFrame
end
You added a lot of parts xd anyways i’ll test it now
It doesn’t seem to work in StarterPlayerScript
did you write it in a LocalScript ?
Yeah I wrote it in local script
did you name the parts same in the workspace ?
Yeah the parts are named in the workspace.
i dont understand it is working in my studio …
It has no errors in the output tho
I already ran it several times in my studio make sure you write it right
the cam change bewteen positions and then back to the player in my studio
I copy pasted the script you wrote and nop it didn’t work. It’s only on the player cam.