Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Camera is a part of workspace, but script says it isn't?

Asked by
2_MMZ 1059 Moderation Voter
3 years ago

Hello, I'm trying to make a GUI that changes the camera position to the part, here's the script that does so:

local camera = game.Workspace.Camera
wait(0.1)
camera.CFrame = game.Workspace.menucamerapart.CFrame
camera.CameraType = Enum.CameraType.Scriptable
game.Lighting.Brightness = 0
game.Lighting.ClockTime = 0
game.Lighting.FogEnd = 20

In the output, it says "menucamerapart is not a valid member of Workspace "Workspace"

Can I get any help on this?

0
either you haven't named it correctly, or you should be using WaitForChild(). also, you should use CurrentCamera rather than the workspace camera. https://devforum.roblox.com/t/currentcamera-vs-camera/796434 Speedmask 661 — 3y
1
Thank you for your assistance. Your solution has worked. What I did was use CurrentCamera, and used WaitForChild. If you would like to gain reputation, please post your answer. 2_MMZ 1059 — 3y
0
nah, it doesn’t matter. however, if you do use currentcamera I don’t think you need waitforchild (from experience), just use a dot Speedmask 661 — 3y
1
What I did in my script was change the workspace camera into CurrentCamera, and used WaitForChild for the camera part. 2_MMZ 1059 — 3y
1
Changing only the camera to CurrentCamera, still didn't work, but however, using WaitForChild for the camera part, worked. 2_MMZ 1059 — 3y

1 answer

Log in to vote
2
Answered by 3 years ago

well if nobody else is going to answer this question in the answers then can i have reputation

Ad

Answer this question