How can I rotate the camera around the humanoidrootpart while no input

Hey, I want check if there is no input since more than 10 sec. If there is no input from the player the camera goes around the humanoidrootpart, and when the player is back, that means when he pressed again something, then it gets the current position.

So how can I achieve that?

This is what I have been trying so far but it doesnt seem work.

local UserInputService = game:GetService("UserInputService")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
hmrp = Character:WaitForChild("HumanoidRootPart")

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

local oldtick = tick()
local inputpressed = false

local t = 0

game:GetService("RunService").RenderStepped:Connect(function(dt)
	if tick() - oldtick <= 5 and inputpressed == true then
		t += dt	
		local hmrpZ = hmrp.Position.Z + 40 * math.sin(t*(math.rad(45)))
		local hmrpX = hmrp.Position.X + 40 * math.cos(t*(math.rad(45)))
		
		camera.CFrame = CFrame.new(hmrpX, hmrp.Position.Y, hmrpZ)
		inputpressed = false
	end
end)

UserInputService.InputBegan:Connect(function(input)
	inputpressed = true
end)