Hello, I am scripting a ViewportFrame and I basically want the character as the model inside of it.
So basically here’s the script:
repeat
wait()
until game:IsLoaded()
local viewportFrame = script.Parent.Inventory.Holder1.ViewportFrame
local Client = game.Players.LocalPlayer
local Char = Client.Character
local viewportCamera = Instance.new("Camera")
viewportCamera.Parent = viewportFrame
viewportCamera.Archivable = true
function UpdateFrame()
for i,v in pairs(viewportFrame:GetChildren())do
if v:isA("Part") or v:isA("Model") then
v:Destroy()
end
end
local VisibleChar = Char:Clone()
VisibleChar.Parent = viewportFrame
viewportFrame.CurrentCamera = viewportCamera
viewportFrame.SelectionImageObject = VisibleChar
SetUpUpdate(VisibleChar)
end
function SetUpUpdate(Object)
Object.Position = Vector3.new(4378.354, -12.235, -2462.885)
viewportCamera.CFrame = CFrame.new(Vector3.new(4378.354, -12.235, -2466.494), Object.Position)
end
wait(1)
UpdateFrame()
and the error line being:
viewportCamera.Parent = viewportFrame
Thanks in advance!