I tried to make a camera with viewport frame in surface gui but it didn't work, It just spam errors
The script is localscript, Map is a model inside the viewport frame, The script is located on the viewport frame
Script:
local Map = script.Parent:WaitForChild("Map")
game:GetService("RunService").RenderStepped:Connect(function()
for i, v in pairs(Map:GetChildren()) do
v:Destroy()
end
for i, v in pairs(game.Workspace:GetChildren()) do
if v.ClassName ~= "Camera" and v.ClassName ~= "Terrain" then
v:Clone().Parent = Map
end
end
end)
Please help.

2 comments
Where is the SurfaceGui located?
StarterGui