LocalScript is not finding "menuCam" a part in the workspace

I’ve tried using the assistant which created the script shown below however it hasn’t worked. I’ve tried using FindFirstChild() and WaitForChild() both not working. I’ve tried looking in the client and server to see what was wrong while playing, both show that “menuCam” exist.

local menuCam = workspace:FindFirstChild('Map') and workspace.Map:FindFirstChild('Assets') and workspace.Map.Assets:FindFirstChild('MenuCam')
local maxTilt = 10

local function updateCamCFrame()
	if menuCam and frame.Parent.Visible == true then
		currentCam.CFrame = menuCam.CFrame * CFrame.Angles(
			math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
			math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
			0
		)
	else
		print("You don't have menuCam or your frame isn't visible.")
	end
end

Screenshot 2025-05-29 212238

I may just be dumb creating this topic or I’m missing something, yet I’ve used everything I can and I’ve decided here is my next big option.

local menuCam = workspace:FindFirstChild('Map') and workspace.Map:FindFirstChild('Assets') and workspace.Map.Assets:FindFirstChild('MenuCam')

Cant you just type workspace.Map.Assets.MenuCam
All assets are already loaded before local script runs unless it parented to ReplicatedFirst.

image

image
I wish…

Are you sure that menucam is actually a child of assets?

I’ve checked while running in studio, on client and server, I’m 101% sure.

It’s most likely StreamingEnabled causing the issue. It causes random errors like this all the time, what I do is put the CFrame directly into the script.

In Play mode, find MenuCam, then print its full CFrame:

print(workspace.Map.Assets.MenuCam.CFrame)

Copy the entire thing and put it into your script:

local menuCamCFrame = CFrame.new(-- paste full CFrame here)

Now you don’t need to load or have the part, you just store the information in your script.

2 Likes

Oh. Ye it can cause the problem. Also you can use command bar in studio to print CFrame of menucam

1 Like

That makes sense of why I could never figure out why it wasn’t working. Anyway I tried it in-game and it works fine, so I suppose that is a solution.

1 Like

MenuCam > ClassType, ensure it’s a part and not a camera. Instead of chaining FindFirstChild, you can simply reference it and try to brute force it so it keeps trying to find the part no matter what.