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.
Could I see the code you have written turning the camera type to scriptable?
also when i change cameratype before renderstepped it changes to custom the same way
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.
the same thing happens with both
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.
Two things:
- Where is the script located and what kind of script is it?
- Is there anything else that is output by the script? Like errors?
- its a localscript under the camerapart
- nothing
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”.
thx that worked, didnt know i was this stupid lol
Glad I could be of help!
P.S., remember to mark a reply as a solution once you’ve reached one
Happy scripting!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.