Hello everyone, so today I was making a loading screen. But I came over a issue. Everytime I tried to change my camera type in won’t work. This is all in a local script btw. First try: game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable. Did not work. Also tried: repeat game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable until game.Workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable
Also did not work. Can someone please help me. Thank you, adminaccount58.
Made a typing error on the dev fourm not on roblox studio.
is there another script messing with camera type? this should work fine otherwise.
Roblox’s core scripts set the CameraType a while after the player loads.
One way to work around this:
repeat wait() until game.Workspace.CurrentCamera
local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
The camera type gets set after the player has been added, enough time for any local script to set the camera type before it does. You will have to set it, wait for it to be changed, then set it again
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera:GetPropertyChangedSignal("CameraType"):Wait()
camera.CameraType = Enum.CameraType.Scriptable
That one worked. But here is a different version that I made and it works.
local attempts = 10
local currentattempts = 0
while true do
if currentattempts == attempts then
break
elseif currentattempts ~= attempts then
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
attempts = attempts +1
wait(.5)
else
wait(“Error happened while try to make camera scriptable.”)
break
end
end
I don’t get it. What’s the point in using a loop? How is this better than what FastKnight401 suggested? Genuinely curious why you made this over using that.
is that supposed to be wait
, or is it supposed to be print
or warn
I meant print, my bad. (Char30)