So I created a menu screen that makes the CameraType “Scriptable”. However, the CameraType is not always set to “Scriptable”. There are no errors in the output. I also used repeat to ensure that it was set to scriptable, but it still didn’t work. Here’s my code:
local cframe = script.CameraCFrame.Value
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
repeat
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
task.wait()
until game.Workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = cframe
while task.wait(0.01) do
game.Workspace.CurrentCamera.CFrame *= CFrame.Angles(0, 0.1/100, 0)
end
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
while task.wait(0.01) do
camera.CFrame *= CFrame.Angles(0, 0.1/100, 0)
end
Comes out as a nice little camera rotation …
Also the camera will not say Scriptable after the call it will say Custom.
I don’t recommend waiting 0.01 seconds. I would rather use TweenService or something similar, because this will slow down the server or whatever is using it.
local rs=game:GetService("RunService")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
while true do rs.Stepped:Wait()
camera.CFrame *= CFrame.Angles(0, 0.1/100, 0)
end
Much better and will work with your game not fight it.
That Stepped:Wait() is gold! Not only will it work but it will mesh with what’s going on atm.
Could ask for a better fast wait! That is the equivalent of the Assembler EOS or Last line call. Basically waiting till the screen is at the bottom of the current frame wipe then triggering. Very nicely keeping everything in sync.
If I was on the client, I would use RenderStepped. For camera movements, I would bind the event to RunService, after Roblox does their thing with the camera.
I wouldn’t be too sure, but I know there’s an Enum thing that you can do and bind it to the Camera value + 1. This will make it go after Roblox does their stuff with the camera. There’s several examples of this but I don’t have time to look it up right now.
-- in ReplicatedStorage as a Localscript
function RotateCamera()
game.Workspace.CurrentCamera.CFrame *= CFrame.Angles(0, 0.1/100, 0)
end
RotateCamera()
game:GetService("RunService"):BindToRenderStep("RotateCamera", 200, RotateCamera)
Good stuff NobleBuild! But how do you stop it and remove the bind? Also wouldn’t everyone see that at the same time?
function RotateCamera()
game.Workspace.CurrentCamera.CFrame *= CFrame.Angles(0, 0.1/100, 0)
end
RunService:BindToRenderStep("RotateCamera", Enum.RenderPriority.Camera.Value - 1, RotateCamera)
local success, err = pcall(RunService:UnbindFromRenderStep("RotateCamera"))
if not success then
warn(err)
end
Also I don’t think that everyone would see it since it is on the client.
I would do exactly that, but I would add one to the priority. We want to do camera stuff after Roblox does, but I wouldn’t know the Enum values and how they’re ordered.