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?
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
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