Hey!
I have a ViewportFrame
inside of a GUI. I have a part in the ViewportFrame
that I am trying to look at from the top. Inside of a LocalScript
I have written:
local ViewportFrame = script.Parent
local Part = ViewportFrame.Part
local Camera = Instance.new("Camera")
ViewportFrame.CurrentCamera = Camera
Camera.Parent = ViewportFrame
local PosX = Part.CFrame.Position.X
local PosY = Part.CFrame.Position.Y
local PosZ = Part.CFrame.Position.Z
Camera.CFrame = CFrame.new(PosX, PosY + 5, PosZ)
I have tried looking at the documentation and online, however, I have found nothing to work.
Any ideas?