Scriptable camera turns to custom once my character loads

So i have this problem where i am making a start menu and setting the camera type to scriptable to move it to a part. When i playtest the game tho, it instantly switches back to custom, and the rest doesnt work.
What i tried: some solutions i could find on other posts, code from free models and the roblox documentation thing.

2 Likes

Could I see the code you have written turning the camera type to scriptable?

1 Like

yea here it is


(the script is a child of the part)

2 Likes

also when i change cameratype before renderstepped it changes to custom the same way

1 Like

Based off what I’m seeing, it looks like the code may not be running at all.

Instead of

repeat wait() until workspace.CurrentCamera

I’d recommend:

local Camera = workspace.CurrentCamera

You could use :WaitForChild() instead, same functionality and maybe more reliable, though you’d likely be fine just getting the camera off the bat from the client side.

2 Likes

the same thing happens with both

2 Likes

Odd. Replicating the same instance by just using .RenderStepped worked fine with me.

Here, instead try it this way:

local cam = workspace.CurrentCamera
local camPart = workspace:WaitForChild("CameraPart")

repeat 
	cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable

cam.CFrame = camPart.CFrame

This avoids constantly setting the camera type and waits until it is set to Scriptable. Though I don’t know the viability and efficiency of this method, it works. Go ahead and try it.

1 Like

so i tried this way


(dont mind the image cut off)
it didnt output anything, not even the first one

1 Like

Two things:

  1. Where is the script located and what kind of script is it?
  2. Is there anything else that is output by the script? Like errors?
1 Like
  1. its a localscript under the camerapart
  2. nothing
2 Likes

That’ll be the issue then. A LocalScript will not run under the Camera object. I’d advise parenting it under your ui in “StarterGui”.

1 Like

thx that worked, didnt know i was this stupid lol

1 Like

Glad I could be of help!

P.S., remember to mark a reply as a solution once you’ve reached one :wink:
Happy scripting!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.