When I try to create a camera with my function :GetViewportFrame(), the camera disappears! No error is recorded, I dont understand why the camera "destroys" itself and how to fix it? Because I do not see any error in my function. Instance.new (type, parent) is supposed to work so I dont understand where the error is.
Script
function InstanceGame:VoteTime() for i = 1, 3 do -- Set three maps. local SurfaceGui = Instance.new('SurfaceGui', MapVoter.System.Screens[i].Screen) SurfaceGui.CanvasSize = Vector2.new(260, 400) SurfaceGui.Face = 'Right' local ViewportFrame = InstanceGame:GetViewportFrame(Map) ViewportFrame.Parent = SurfaceGui end end function InstanceGame:GetViewportFrame(Receive) local ViewportFrame = Instance.new('ViewportFrame') ViewportFrame.Size = UDim2.new(1, 0, 1, 0) local Map = Receive:Clone() Map.Parent = ViewportFrame local Camera = Instance.new('Camera', ViewportFrame) ViewportFrame.CurrentCamera = Camera Camera.CFrame = Map.Cinematic.PartA.CFrame return ViewportFrame end