Implement camera rotation in this script

i want to make the camera rotate around the model in the viewportframe
how can i implement it inside here

local zoomOut = 4.5
local VPF = script.Parent:WaitForChild("ViewportFrame")


local player = game.Players.LocalPlayer

function render(object)
	local cam = Instance.new("Camera")
	object.Archivable = true
	
	local clone = object:Clone()
	clone.Parent = VPF
	
	local cam = Instance.new("Camera")
	cam.Parent = VPF
	

	
	pcall(function()
		if object:IsA("Model") and object.Humanoid and object.Hitbox then
			cam.CFrame = CFrame.new(clone["Hitbox"].Position + (clone:WaitForChild("Hitbox").CFrame.lookVector * zoomOut) + Vector3.new(0,0,0), clone.Hitbox.Position)

		elseif object:IsA("MeshPart") then
			cam.CFrame = CFrame.new(clone.Position + (clone.CFrame.lookVector * zoomOut) + Vector3.new(0,1,0), clone.Position)

		end
	end)
	
	VPF.CurrentCamera = cam
	
	
end

function ResetVPF()
	VPF:ClearAllChildren()
	VPF.CurrentCamera = nil -- nil is equal to nothing
end

render(game.ReplicatedStorage.Pets.Ctulu)

I made this a while ago which should work

local distanceFromPart = --any value
local heightFromPart = --any value
local step = 0

local function onRenderStepped(dt)
	step += 1 * (dt * 60)
	local orbitcframe = CFrame.new(partToRotateAround.Position) * CFrame.Angles(0, math.rad(step % 360), 0) * CFrame.new(0, heightFromPart , -distanceFromPart )
	camera.CFrame = CFrame.new(orbitcframe.p, partToRotateAround.Position)
end
		
runService:BindToRenderStep("RotateCamera", 1, onRenderStepped)

I used BindToRenderStep because I had to unbind it after but this should work if you use RenderStepped

making me lag alot (this is for the min characters)

weird I’ve used this in the past and never had lag with it

This is what I used it for and as you can see there is no lag at all (ignoring the quality of the video)

oops my fault i was running then camera.Instance.new inside the function so it was creating infinite cameras