Apparently UnitedKingdom is not a valid member when it is

Apparently UnitedKingdom is not a valid member when it is.

Im trying the set the players camera to a part called UnitedKingdom, I have done this with other parts and it has worked correctly but for some reason I get an error this time.

Code:

local Camera = game.Workspace.CurrentCamera
local Part = game.Workspace.MapGlobe.Countries.UnitedKingdom

Camera.CameraType = Enum.CameraType.Follow -- Change this to fit your needs if necessary
Camera.CameraSubject = Part

As you can see from the code the part is located inside of a folder called “Countries” and that folder is located in “MapGlobe” maybe this has something to do with it?

Heres the error I get in the output:

I have tried multiple solutions I found on the DevForum but none of them have worked:

:roblox_light: Referencing it via FindFirstChild() and WaitForChild() don’t work.
:roblox_light: Changing the script to a ServerScript doesn’t work.

Lastly here is what is looks like in the explorer:

image

I also have all beta features enabled if that changes anything.

1 Like

Use :waitforchild()
as it isn’t there at execution

try this

for i, v in pairs(game.Workspace.MapGlobe.Countries:GetChildren()) do
	if string.find(v.Name, "UnitedKing") then
		local Camera = game.Workspace.CurrentCamera
		Camera.CameraType = Enum.CameraType.Follow
		Camera.CameraSubject = v
	end
end

he said that he already tried that

I have already tried that and it gives me the same error.

then PUT IT WHERE IT ERRORED??
waitforchild never errors it will yield until it exists

Doesn’t work it just sets the camera to my player like it usually would.

could you launch the game and then send us the picture of countries folder

Im also not getting an error in the output

could you click on unitedkingdom and then send it

Should I send you it’s properties?

Ye properties of that part .//


Try this script I just made it and it worked fine

if not game:IsLoaded() then
	game.Loaded:Wait()
end

local Camera = game.Workspace.Camera

local Countries = game.Workspace.MapGlobe.Countries

Camera.CameraType = Enum.CameraType.Follow
Camera.CameraSubject = Countries.UnitedKingdom

I got the same error as before

try to rename your part to this UnitedKingdom

I tried it and got the same error

are you sure that you copied my script and not just a part of it

1 Like

I copied the entire script
image