I need help fixing my viewportframe so it shows specific models in my items folder. In the script it only shows everything at once but I don’t wan that.

here is the code

```
local vpf = script.Parent
local items = script.Parent:WaitForChild("Items")
local children = items:GetChildren()
local index, event = 1, nil
local camera = Instance.new("Camera")
camera.FieldOfView = 10
vpf.CurrentCamera = camera
vpf.Visible = true
-- rotation
local function setRotationEvent(model)
local currentAngle = 0
local modelCF, modelSize = model:GetBoundingBox()
local rotInv = (modelCF - modelCF.p):inverse()
modelCF = modelCF * rotInv
modelSize = rotInv * modelSize
modelSize = Vector3.new(math.abs(modelSize.x), math.abs(modelSize.y), math.abs(modelSize.z))
local diagonal = 0
local maxExtent = math.max(modelSize.x, modelSize.y, modelSize.z)
local tan = math.tan(math.rad(camera.FieldOfView/2))
if (maxExtent == modelSize.x) then
diagonal = math.sqrt(modelSize.y*modelSize.y + modelSize.z*modelSize.z)/2
elseif (maxExtent == modelSize.y) then
diagonal = math.sqrt(modelSize.x*modelSize.x + modelSize.z*modelSize.z)/2
else
diagonal = math.sqrt(modelSize.x*modelSize.x + modelSize.y*modelSize.y)/2
end
local minDist = (maxExtent/2)/tan + diagonal
return game:GetService("RunService").RenderStepped:Connect(function(dt)
currentAngle = currentAngle + 1*dt*40
camera.CFrame = modelCF * CFrame.fromEulerAnglesYXZ(0, math.rad(currentAngle), 0) * CFrame.new(0, 0, minDist + 3)
end)
end
local function setIndexActive(newIndex)
if (event) then
event:Disconnect()
children[index].Parent = items
end
index = newIndex
event = setRotationEvent(children[index])
children[index].Parent = vpf
end
--
setIndexActive(index)
vpf.InputBegan:Connect(function(input)
if (input.UserInputType == Enum.UserInputType.MouseButton1) then
end
end)
```

and here is a video showing it