i put this code on a "Script" inside SurfaceGui:
local viewportFrame = Instance.new("ViewportFrame") viewportFrame.Size = UDim2.new(1, 0, 1, 0) viewportFrame.Position = UDim2.new(0, 15, 0, 15) viewportFrame.BackgroundColor3 = Color3.new(0, 0, 0) viewportFrame.BorderColor3 = Color3.new(0.6, 0.5, 0.4) viewportFrame.BorderSizePixel = 2 viewportFrame.BackgroundTransparency = 0.25 viewportFrame.Parent = script.Parent local part = Instance.new("Part") part.Material = Enum.Material.Concrete part.BrickColor = BrickColor.new("Bright blue") part.Position = Vector3.new(0,0,0) part.Parent = viewportFrame local viewportCamera = Instance.new("Camera") viewportFrame.CurrentCamera = viewportCamera viewportCamera.Parent = viewportFrame viewportCamera.CFrame = CFrame.new(Vector3.new(0,2,12), part.Position)
it doesn't work.
however when I converted it to "Localscript" and put it on on ScreenGui, it works perfectly fine.
hmm...
I believe if you put the SurfaceGui
into StarterGui
and keep the script local, then all you have to do is change the Adornee
property of the Gui in order to make this work.