Help with tick()

so im trying to make a system were once something has been placed and hasnt been picked up for 5 seconds, something happens
ive tried using tick multiple times but it isnt working
example:

local lastpickedup = tick()
--place function
lastpickedup = tick()
      task.spawn(function()
			while task.wait() do
				if  tick() - lastpickedup > 4 then
				--do something
				end
			end
		end)
end)
--pick up function
lastpickedup = tick() -- or 0 idk; reset the timer cause it was just picked up
end)

so basically once object is placed, if it hasnt been picked up in 4 seconds then print()
if it has been picked up then dont print

Use task.delay and cancel it with task.cancel if it’s picked up. Check out the task documentation for more information.

can you show me an example for my use case?