Not a valid member of Workspace "Workspace"

  1. What do you want to achieve? I’m trying to make a game menu where the i set the CFrame of the camera to a part.

  2. What is the issue? The error in the screenshot is displayed.

  3. What solutions have you tried so far? I have been looking for solutions yet unable to find one.

The code is placed inside a gui object in StarterGui.

local campart = workspace.CameraPart
local camera = workspace.CurrentCamera

repeat wait() 
	camera = Enum.CameraType.Scriptable
until camera == Enum.CameraType.Scriptable
camera.CFrame = campart.CFrame


I am genuinely confused since it appears to work in other games.

2 Likes

Have you tried using WaitForChild?

local campart = workspace:WaitForChild("CameraPart")
local camera = workspace.CurrentCamera

Do you use “CameraPart” in other scripts?

1 Like

This appears when I use WaitForChild.

It’s the only script in the game since it’s new.

local campart = workspace:WaitForChild("CameraPart")
local camera = workspace.CurrentCamera

camera.CameraType= Enum.CameraType.Scriptable
camera.CFrame = campart.CFrame

Try this.
Does this work?

1 Like

It worked, thanks!

Not sure what went wrong though.

This part. You forgot to set the CameraType .(you accidentally tried to set the camera itself to a CameraType which is an enum)

1 Like