Attempted to index nil with CFrame?

My part exists in workspace & other spawn points such as black water work. I’m confused.

Part exists in-game:
image

Explorer:
image

Code:

Client:

elseif args[1] == "SetCamera" then
		if args[3] == true then
			local camera = workspace.CurrentCamera
			camera.CameraSubject = Player.Character.Humanoid
			camera.CameraType = Enum.CameraType.Custom
			camera.CFrame = Player.Character.Head.CFrame
		elseif args[3] == false then
			local camera = workspace.CurrentCamera
			camera.CameraSubject = args[2]
			camera.CameraType = Enum.CameraType.Scriptable
			camera.CFrame = args[2].CFrame
		end

Database:

Console:

2 Likes

Which line is line 15? Which line is line 15?

Side note you’re not supposed to post screenshots of code but I think see your problem

Remote:FireClient(Player, "SetCamera", workspace.Spawns.Cameras[i]

Unless i is the name of a part inside Spawns then you just need a :GetChildren() which returns a array.
Indexing instances without :GetChildren() requires their name since Instances with children have dictionaries with their names as keys.

I managed to fix it apparently the part was too far from the clients streaming area I fixed it with Player:RequestStreamAroundAsync(part position)

i was the name of the part & was looking for that part in a folder.