I don't really know much about viewportframes, however what I am trying to do is have an npc appear in a frame on the player's UI with movement. I did this using the technique shown on the devforums, however all I see is a static image that doesn't move. How would I constantly update the viewportframe to show the latest position of the npc?
Here is my code, does not portray movement:
local player = game.Players.LocalPlayer
local vp = player:WaitForChild("PlayerGui"):WaitForChild("CountDown"):WaitForChild("Members").Frame.ViewportFrame
local obj = workspace.TestSubject
local camera = Instance.new("Camera")
obj.Parent = vp
camera.Parent = vp
vp.CurrentCamera = camera
local pos = obj.PrimaryPart.Position + obj.PrimaryPart.CFrame.LookVector*6
local lookAt = obj.PrimaryPart.Position
camera.CFrame = CFrame.new(pos + Vector3.new(0,1,0), lookAt)
